<center><h2>About</h2></center>
''Medieval Pits'' is a collection of three short text-based games set in a grim, low-fantasy medieval world, each delving into the brutal and treacherous world of fighting pits:
''Pit Fighters'': Engage in tactical combat against random enemies in one of three modes: Duel, Skirmish, and Champion Challenge. Survive to level 10 to win.
''Pit Masters'': Take on the role of a pit master in this management game. Organize events, outwit rivals, and rise to power by amassing 10 reputation points.
''Pit Rats'': Explore the dark underbelly of the fighting pits as a rebel fighter in pursuit of a corrupt pit master. Win by defeating the Pit Master or by betraying your fellow fighters.
This game is based on Medieval Pits TTRPG, made for the Indie TTRPG Generator Game Jam and based on a single random result: Medieval Pits - an anthology of games for 3-6 players.
[[Medieval Pits TTRPG|https://janosbiro.itch.io/medieval-pits]]
[[Version 0.1.4|Version]]
[[Back|Intro]]<<set $caption to false>>\
<center><h2>Cemetery</h2></center>
<<set $cemeteryList = recall('cemeteryList') ?? []>>\
<<if $cemeteryList.length > 0>>\
<<for _charData range $cemeteryList>>\
<<set $characterData = { name: _charData.name, background: _charData.background, health: _charData.health, stamina: _charData.stamina, reputation: _charData.reputation, actionPoints: _charData.actionPoints, playerSkill: _charData.playerSkill, motivation: _charData.motivation, playerInv: _charData.playerInv, level: _charData.level, death: _charData.death}>>\
<<capture _charData>>\
<<link '_charData.name: _charData.background _charData.level'>><<set $sel = _charData>><<goto "Tomb Details">><</link>> \
<</capture>>\
<</for>>\
<<else>>\
There are no dead fighters.
<</if>>
[[Back|Intro]]<center><h2>Choose Fight</h2></center>
Select a fight:
[[Duel|Confirm Fight][$fightMode to "Duel"]] \
[[Skirmish|Confirm Fight][$fightMode to "Skirmish"]] \
[[Champion|Confirm Fight][$fightMode to "Champion"]]
[[Level up]]
[[Back|Select Fighter]]<<widget "showfoe">>\
<<if $close>>\
''$foe.name ($foe.background $foe.level) - CLOSE''\
<<else>>\
$foe.name ($foe.background $foe.level)\
<</if>>\
<<set $metername to "foeBar">>\
<<showmeter $metername `$foe.health / $foe.maxhealth`>>\
Gear: <<= $foe.inv.list>>\
<</widget>>
<<widget "ChooseWeapon">>\
<<set $staminadamage = 0>><<set $weapon to "">>\
<<dialog "Choose Weapon">>\
<<if $close>>\
<<link "Unarmed">>\
<<set $skillType = "Unarmed">><<set $apCost = 1>><<set $staminaCost = 1>><<set $damage = 1>><<set $staminadamage = 1>>\
<<dialogclose>><<modifiers>>\
<</link>> \
<<if $playerInv.has("Sword")>>\
<<link "Sword">>\
<<set $skillType = "Melee">><<set $apCost = 1>><<set $staminaCost = 1>><<set $damage = 2>><<set $weapon to "Sword">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Mace")>>\
<<link "Mace">>\
<<set $skillType = "Melee">><<set $apCost = 1>><<set $staminaCost = 1>><<set $damage = 1>><<set $staminadamage = 2>><<set $weapon to "Mace">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Spear")>>\
<<link "Spear">>\
<<set $skillType = "Melee">><<set $apCost = 1>><<set $staminaCost = 2>><<set $damage = 2>><<set $weapon to "Spear">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<</if>>\
<<if $playerInv.has("Sword")>>\
<<link "Throw Sword">>\
<<set $skillType = "Versatile">><<set $apCost = 1>><<set $staminaCost = 1>><<set $damage = 1>><<set $weapon to "Sword">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Mace")>>\
<<link "Throw Mace">>\
<<set $skillType = "Versatile">><<set $apCost = 1>><<set $staminaCost = 1>><<set $damage = 1>><<set $staminadamage = 1>><<set $weapon to "Mace">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Spear")>>\
<<link "Throw Spear">>\
<<set $skillType = "Versatile">><<set $apCost = 1>><<set $staminaCost = 2>><<set $damage = 2>><<set $weapon to "Spear">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Bow")>>\
<<link "Bow">>\
<<set $skillType = "Archery">><<set $apCost = 2>><<set $staminaCost = 1>><<set $damage = 1>><<set $weapon to "Bow">>\
<<dialogclose>><<modifiers>>\
<</link>> \
<</if>>\
<<if $playerInv.has("Crossbow")>>\
<<link "Crossbow">>\
<<set $skillType = "Archery">><<set $apCost = 3>><<set $staminaCost = 1>><<set $damage = 2>><<set $weapon to "Crossbow">>\
<<dialogclose>><<modifiers>>\
<</link>>\
<</if>>
<<link "Cancel">>\
<<dialogclose>>\
<</link>>\
<</dialog>>\
<</widget>>
<<widget "modifiers">>\
<<dialog "Apply Modifiers (Optional)">>\
<<set $knock to false>><<set $disarm to false>><<set $strong to false>><<set $aimed to false>>\
Each modifier increases the attack stamina cost by 1.
<<link "Strong Attack: Damage +1.">><<if $strong>><<set $strong to false>><<else>><<set $strong to true>><</if>><<redo>><</link>>
<<link "Aimed Attack: Damage ignores armor.">><<if $aimed>><<set $aimed to false>><<else>><<set $aimed to true>><</if>><<redo>><</link>>
<<link "Knock Attack: Test Unarmed: Opponent loses one turn.">><<if $knock>><<set $knock to false>><<else>><<set $knock to true>><<set $disarm to false>><</if>><<redo>><</link>>
<<link "Disarm Attack: Test Versatile: Opponent drops weapon.">><<if $disarm>><<set $disarm to false>><<else>><<set $disarm to true>><<set $knock to false>><</if>><<redo>><</link>>
<<do>><<set $totalCost to $staminaCost>>\
<<if $strong>><<set $totalCost += 1>>Strong <</if>>\
<<if $aimed>><<set $totalCost += 1>>Aimed <</if>>\
<<if $knock>><<set $totalCost += 1>>Knock <</if>>\
<<if $disarm>><<set $totalCost += 1>>Disarm <</if>>\
Attack.
Stamina cost: $totalCost. AP cost: $apCost.
<</do>>\
<<link "Confirm">><<set $staminaCost to $totalCost>><<ExecuteAttack>><</link>> \
<<link "Cancel">><<dialogclose>><</link>>
<</dialog>>\
<</widget>>
<<widget "roll">>\
<<silent>>\
<<switch _args[0]>>
<<case 0>>
<<set $chance to 0.35>>
<<case 1>>
<<set $chance to 0.5>>
<<case 2>>
<<set $chance to 0.65>>
<<case 3>>
<<set $chance to 0.80>>
<<case 4>>
<<set $chance to 0.95>>
<<default>>
<<if _args[0] < 0>>
<<set $chance to 0>>
<<else>>
<<set $chance to 1>>
<</if>>
<</switch>>
<</silent>>\
<</widget>>
<<widget "ExecuteAttack">>\
<<silent>>\
<<set $mes to "">>
<<set $weapon_broken to false>>
<<set $enemy_weapon_broken to false>>
<<set $enemy_armor_broken to false>>
<<set $enemy_shield_broken to false>>
// Verifica se o jogador tem pontos de ação e estamina suficientes para atacar
<<if $actionPoints >= $apCost and $stamina >= $staminaCost>>
<<set $skillTest = 0>>
// Determina a habilidade usada no ataque com base no tipo de arma
<<switch $skillType>>
<<case "Unarmed">>
<<set $skillTest = $playerSkill.count('Unarmed')>>
<<case "Melee">>
<<set $skillTest = $playerSkill.count('Melee')>>
<<if random(1, 4) is 1>><<if $playerInv.count($weapon) is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv $weapon 1>><</if>>
<<case "Versatile">>
<<set $skillTest = $playerSkill.count('Versatile')>>
<<if random(1, 3) is 1>><<if $playerInv.count($weapon) is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv $weapon 1>><</if>>
<<transfer $playerInv $droppedList $weapon $playerInv.count($weapon)>>
<<case "Archery">>
<<set $skillTest = $playerSkill.count('Archery')>>
<<if random(1, 2) is 1>><<if $playerInv.count($weapon) is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv $weapon 1>><</if>>
<</switch>>
// Se o jogador reposicionou, ganha um bônus no teste de habilidade
<<if $reposition>>
<<set $skillTest += 1>>
<<set $reposition = false>>
<</if>>
// Rola o teste de ataque
<<roll $skillTest>>
<<if Math.random() <= $chance>>
// Verifica se o inimigo consegue esquivar
<<set $dodged to false>>
<<roll $foe.skill.count("Versatile")>>
<<if Math.random() <= $chance and $foe.actionPoints >= 1 and !$foe.inv.has("Plate Armor")>>
<<if $foe.stamina >= 1 and !$foe.inv.has("Chainmail")>>
<<set $foe.stamina -= 1>>
<<set $foe.actionPoints -= 1>>
<<set $dodged to true>>
<<elseif $foe.stamina >= 2 and $foe.inv.has("Chainmail")>>
<<set $foe.stamina -= 2>>
<<set $foe.actionPoints -= 1>>
<<set $dodged to true>>
<</if>>
<</if>>
// Se o inimigo não esquivou, verifica se ele pode bloquear
<<if !$dodged>>
<<if $foe.stamina >= 1 and $foe.inv.has("Shield") and random(1,2) is 1>>
<<set $foe.stamina -= 1>>
<<set $damage = Math.max(0, $damage - 1)>>
<<if random(1,2) is 1>><<if $foe.inv.count("Shield") is 1>><<set $enemy_shield_broken to true>><</if>><<drop $foe.inv "Shield" 1>><</if>>
<<set $mes += $foe.name + " blocks with Shield. ">>
<<elseif $foe.stamina >= 1 and $foe.inv.hasAny($meleeGear.list) and random(1,3) is 1>>
<<set $foe.stamina -= 1>>
<<set $damage = Math.max(0, $damage - 1)>>
<<if $foe.inv.has("Sword")>>
<<if random(1,3) is 1>><<if $foe.inv.count("Sword") is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv "Sword" 1>>
<<set $mes += $foe.name + " blocks with Sword. ">>
<</if>>
<<elseif $foe.inv.has("Mace")>>
<<if random(1,4) is 1>><<if $foe.inv.count("Mace") is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv "Mace" 1>>
<<set $mes += $foe.name + " blocks with Mace. ">>
<</if>>
<<elseif $foe.inv.has("Spear")>>
<<if random(1,2) is 1>><<if $foe.inv.count("Mace") is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv "Spear" 1>>
<<set $mes += $foe.name + " blocks with Spear. ">>
<</if>>
<</if>>
<</if>>
// Aplica modificadores de ataque
<<if $strong>>
<<set $damage += 1>>
<</if>>
<<if !$aimed and $foe.inv.hasAny($armor.list)>>
<<set $damage = Math.max(0, $damage - 1)>>
<<if $foe.inv.has("Leather Armor")>><<if $foe.inv.count("Leather Armor") is 1>><<set $enemy_armor_broken to true>><</if>><<drop $foe.inv "Leather Armor" 1>><</if>>
<<if $foe.inv.has("Chainmail")>><<if $foe.inv.count("Chainmail") is 1>><<set $enemy_armor_broken to true>><</if>><<drop $foe.inv "Chainmail" 1>><</if>>
<<if $foe.inv.has("Plate Armor")>><<if $foe.inv.count("Plate Armor") is 1>><<set $enemy_armor_broken to true>><</if>><<drop $foe.inv "Plate Armor" 1>><</if>>
<</if>>
// Aplica dano corretamente
<<set $mes += "You hit " + $foe.name + ". Dealt " + $damage + " damage. ">>
<<set $foe.health -= $damage>>
<<set $foe.stamina -= $staminadamage>>
<<if $staminadamage > 0>><<set $mes += "Dealt " + $staminadamage + " stamina damage. ">><</if>>
<<if $foe.stamina < 0>>
<<set $foe.stamina to 0>>
<<set $knockedEnemy to true>>
<<set $mes += $foe.name + " was knocked back! ">>
<</if>>
// Aplica o efeito Knock (reduz AP do inimigo)
<<if $knock>>
<<roll $playerSkill.count("Unarmed")>>
<<if Math.random() <= $chance>>
<<set $mes += $foe.name + " was knocked back! ">>
<<set $knockedEnemy to true>>
<</if>>
<</if>>
// Aplica o efeito Disarm (remove arma do inimigo)
<<set _enemyWeapon = "">>
<<if $disarm>>
<<roll $playerSkill.count("Versatile")>>
<<if Math.random() <= $chance>>
<<for _item range $foe.inv.list>>
<<if $allWeapons.has(_item)>>
<<set _enemyWeapon = _item>>
<<break>>
<</if>>
<</for>>
<<if _enemyWeapon neq "">>
<<transfer $foe.inv $droppedList _enemyWeapon $foe.inv.count(_enemyWeapon)>>
<<set $mes += $foe.name + " was disarmed and dropped their " + _enemyWeapon + "! ">>
<<set $disarm to false>>
<</if>>
<</if>>
<</if>>
//Aviso de equipamento quebrado
<<if $weapon_broken>><<set $mes += "Your " + $weapon + " is broken! ">><</if>>
<<if $enemy_weapon_broken>><<set $mes += $foe.name + " weapon is broken! ">><</if>>
<<if $enemy_shield_broken>><<set $mes += $foe.name + " shield is broken! ">><</if>>
<<if $enemy_armor_broken>><<set $mes += $foe.name + " armor is broken! ">><</if>>
// Verifica se o inimigo morreu
<<if $foe.health <= 0>>
<<set $mes += $foe.name + " is down! ">>
<</if>>
<<else>>
<<set $mes = $foe.name + " dodged the attack! ">>
<</if>>
<<else>>
<<set $mes = "You missed the attack! ">>
<</if>>
// Deduz ação e estamina do jogador
<<set $actionPoints -= $apCost>>
<<set $stamina -= $staminaCost>>
<<else>>
<<set $mes = "Not enough Action Points or Stamina. ">>
<</if>>
<<redo>>
<<dialogclose>>
<<redo>>
<</silent>>\
<</widget>>
<<widget "EnemyTurn">>
<<set $mes to "">>
<<set $foe.actionPoints to $foe.maxactionPoints>>
<<if $knockedEnemy>>
<<set $foe.actionPoints to 0>>
<<set $knockedEnemy to false>>
<</if>>
<!-- Se o inimigo estiver ferido e tiver uma bandagem, usa (1 AP) -->
<<if $foe.actionPoints >= 1 and $foe.health < $foe.maxhealth/2 and $foe.inv.has("Bandages")>>
<<drop $foe.inv "Bandages" 1>>
<<set $foe.health to Math.min($foe.health + Math.floor($foe.maxhealth / 2), $foe.maxhealth)>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " uses a Bandage to recover some Health. ">>
<</if>>
<!-- Se o inimigo estiver com pouca Stamina e tiver uma Strong Brew, usa (1 AP) -->
<<if $foe.actionPoints >= 1 and $foe.stamina <= 1 and $foe.inv.has("Strong Brew")>>
<<drop $foe.inv "Strong Brew" 1>>
<<set $foe.stamina to $foe.maxstamina>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " drinks a Strong Brew, recovering all Stamina. ">>
<</if>>
<!-- Se o inimigo estiver com pouca Stamina e não tiver uma Strong Brew, usa Recover (1 AP) -->
<<if $foe.actionPoints >= 1 and $foe.stamina <= $foe.maxstamina/2>>
<<set $foe.stamina to Math.min($foe.stamina + Math.floor($foe.maxstamina / 2), $foe.maxstamina)>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " recovers some Stamina. ">>
<</if>>
<!-- Se houver alguma arma no chão, ele a pega (1 AP) -->
<<if $foe.actionPoints >= 1 and $droppedList.length > 0>>
<<set _weaponToPick = null>>
<<for _item range $droppedList.list>>
<<if (_item is "Bow" or _item is "Crossbow") and $foe.skill.has("Archery")>>
<<set _weaponToPick = _item>>
<<break>>
<<elseif ($foe.skill.has("Melee") or $foe.skill.has("Versatile"))>>
<<set _weaponToPick = _item>>
<<break>>
<</if>>
<</for>>
<!-- Se encontrou uma arma válida, pega -->
<<if _weaponToPick>>
<<transfer $droppedList $foe.inv _weaponToPick $droppedList.count(_weaponToPick)>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " picks up a " + _weaponToPick + " from the ground. ">>
<</if>>
<</if>>
<!-- Verifica se o inimigo tem arma de longo alcance -->
<<set _hasRangedWeapon = $foe.inv.hasAny("Bow", "Crossbow")>>
<<if $foe.skill.count("Versatile") > $foe.skill.count("Melee") and $foe.inv.has("Spear")>>
<<set _hasRangedWeapon to true>>
<</if>>
<!-- Se o inimigo tem arma de longo alcance, se afasta (1 AP) -->
<<if $foe.actionPoints >= 1 and _hasRangedWeapon and $close and random(1,100) <= 75>>
<<set $close to false>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " moves away to attack from a distance. ">>
<</if>>
<!-- Se o inimigo não tem arma de longo alcance, se aproxima (1 AP) -->
<<if $foe.actionPoints >= 1 and !_hasRangedWeapon and !$close and random(1,100) <= 85>>
<<set $close to true>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " moves closer to engage in combat. ">>
<</if>>
<!-- Chance de 50% de Reposition antes do ataque (1 AP) -->
<<if $foe.actionPoints >= 1 and random(1,100) <= 50 and $foe.reposition is false>>
<<set $foe.reposition to true>>
<<set $foe.actionPoints -= 1>>
<<set $mes += $foe.name + " repositions for a better stance. ">>
<</if>>
<!-- Chance de 65% de atacar -->
<<if random(1,100) <= 65>>
<<set _weapon to "">>
<<if $close>>
<!-- Escolhe uma arma se estiver perto -->
<<set _weapon = "Bare hands">><<set $apcost to 1>><<set $staminacost to 1>>
<<for _item range $foe.inv.list>>
<<if $allWeapons.has(_item)>>
<<set _weapon = _item>>
<<break>>
<</if>>
<</for>>
<!-- Se tiver Versatile maior que Melee, arremessa a arma -->
<<set _throwWeapon = false>>
<<if $foe.skill.count("Versatile") > $foe.skill.count("Melee")>>
<<if _weapon is "Sword" or _weapon is "Mace" or _weapon is "Spear">>
<<set _throwWeapon = true>>
<<set $apcost to 1>><<set $staminacost to 1>>
<<if _weapon is "Spear">><<set $staminacost to 2>><</if>>
<</if>>
<</if>>
<<else>>
<!-- Escolhe uma arma de longo alcance se estiver longe -->
<<for _item range $foe.inv.list>>
<<if _item is "Bow" or _item is "Crossbow">>
<<set _weapon = _item>>
<<set $apcost to 2>><<set $staminacost to 1>>
<<if _weapon is "Crossbow">><<set $apcost to 3>><</if>>
<<break>>
<</if>>
<!-- Arremessa uma arma se não tiver Bow ou Crossbow -->
<<set _throwWeapon = false>>
<<if _item is "Sword" or _item is "Mace" or _item is "Spear">>
<<set _weapon = _item>>
<<set _throwWeapon = true>>
<<break>>
<</if>>
<</for>>
<</if>>
<!-- Determina modificadores de ataque -->
<<set _strong = false>>
<<set _aimed = false>>
<<set _knock = false>>
<<set _disarm = false>>
<<if random(1,100) <= 25 and $foe.stamina >= $staminacost + 1>><<set _strong to true>><<set $staminacost += 1>><</if>>
<<if random(1,100) <= 25 and $foe.stamina >= $staminacost + 1 and $playerInv.hasAny($armor.list)>><<set _aimed to true>><<set $staminacost += 1>><</if>>
<!-- 25% de chance de Knock ou Disarm, mas nunca os dois juntos -->
<<if random(1,100) <= 25 and $foe.stamina >= $staminacost + 1>>
<<if random(1,2) == 1>>
<<set _knock = true>><<set $staminacost += 1>>
<<else>>
<<if $playerInv.hasAny($allWeapons.list)>><<set _disarm = true>><<set $staminacost += 1>><</if>>
<</if>>
<</if>>
<<if _weapon isnot "" and $foe.actionPoints >= $apcost and $foe.stamina >= $staminacost>>
<!-- Executa o ataque com os modificadores -->
<<ExecuteEnemyAttack _weapon _strong _aimed _knock _disarm _throwWeapon>>
<<else>>\
<<set $mes += $foe.name + " conserves energy, preparing to defend. ">>
<<set $actionPoints to $maxActionPoints>>
<<if $knocked>><<set $actionPoints -= 2>><<set $knocked to false>><</if>>
<<redo>>
<</if>>
<<else>>
<<set $mes += $foe.name + " conserves energy, preparing to defend. ">>
<<set $actionPoints to $maxActionPoints>>
<<if $knocked>><<set $actionPoints to 0>><<set $knocked to false>><</if>>
<<redo>>
<</if>>
<</widget>>
<<widget "ExecuteEnemyAttack">>\
<<silent>>\
<<set $enemy_weapon_broken to false>>
<<set $weapon_broken to false>>
<<set $armor_broken to false>>
<<set $shield_broken to false>>
<<set $knocked to false>>
<<set $weapon = _args[0]>>
<<set _strong = _args[1]>>
<<set _aimed = _args[2]>>
<<set _knock = _args[3]>>
<<set _disarm = _args[4]>>
<<set _throwWeapon = _args[5]>>
<<set $staminadamage = 0>>
<!-- Define os valores de AP, Stamina e dano com base na arma -->
<<switch $weapon>>
<<case "Bare hands">>
<<set $skillType = "Unarmed">>
<<set $damage = 1>><<set $staminadamage = 1>>
<<case "Sword">>
<<set $skillType = "Melee">>
<<set $damage = 2>>
<<if _throwWeapon>><<set $damage = 1>><<set $skillType = "Versatile">><</if>>
<<case "Mace">>
<<set $skillType = "Melee">>
<<set $damage = 1>><<set $staminadamage = 2>>
<<if _throwWeapon>><<set $damage = 1>><<set $staminadamage = 1>><<set $skillType = "Versatile">><</if>>
<<case "Spear">>
<<set $skillType = "Melee">>
<<set $damage = 2>>
<<if _throwWeapon>><<set $damage = 2>><<set $skillType = "Versatile">><</if>>
<<case "Bow">>
<<set $skillType = "Archery">>
<<set $damage = 1>>
<<case "Crossbow">>
<<set $skillType = "Archery">>
<<set $damage = 2>>
<</switch>>
<!-- Ajusta a mensagem -->
<<if _throwWeapon>>
<<set $mes += $foe.name + " throws their " + _weapon + "! ">>
<<else>>
<<set $mes += $foe.name + " attacks with their " + _weapon + "! ">>
<</if>>
<!-- Aplica modificadores de ataque -->
<<if _strong>><<set $damage += 1>><<set $mes += "(Strong Attack) ">><</if>>
<<if _aimed>><<set $mes += "(Aimed Attack) ">> <</if>>
<!-- Se o inimigo tem AP e Stamina suficientes -->
<<if $foe.actionPoints >= $apcost and $foe.stamina >= $staminacost>>
<<set $skillTest = $foe.skill.count($skillType)>>
<!-- Bônus de reposicionamento -->
<<if $foe.reposition>>
<<set $skillTest += 1>>
<<set $foe.reposition = false>>
<</if>>
<!-- Teste de ataque -->
<<roll $skillTest>>
<<if Math.random() <= $chance>>
<!-- Tentativa de esquiva do jogador -->
<<set $dodged = false>>
<<roll $playerSkill.count("Versatile")>>
<<if Math.random() <= $chance and $actionPoints >= 1 and !$playerInv.has("Plate Armor")>>
<<if $stamina >= 1 and $actionPoints >= 1 and !$playerInv.has("Chainmail")>>
<<set $stamina -= 1>>
<<set $actionPoints -= 1>>
<<set $dodged = true>>
<<elseif $stamina >= 2 and $actionPoints >= 1 and $playerInv.has("Chainmail")>>
<<set $stamina -= 2>>
<<set $actionPoints -= 1>>
<<set $dodged = true>>
<</if>>
<</if>>
<!-- Bloqueio do jogador -->
<<if !$dodged>>
<<if $stamina >= 1 and $playerInv.has("Shield") and random(1,2) is 1>>
<<set $stamina -= 1>>
<<set $damage = Math.max(0, $damage - 1)>>
<<if random(1,2) is 1>><<if $playerInv.count("Shield") is 1>><<set $shield_broken to true>><</if>><<drop $playerInv "Shield" 1>><</if>>
<<set $mes += "You block the attack with your Shield. ">>
<<elseif $stamina >= 1 and $playerInv.hasAny($meleeGear.list) and random(1,3) is 1>>
<<set $stamina -= 1>>
<<set $damage = Math.max(0, $damage - 1)>>
<<if $playerInv.has("Sword")>>
<<if random(1,3) is 1>><<if $playerInv.count("Sword") is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv "Sword" 1>>
<<set $mes += "You block the attack with your Sword. ">>
<</if>>
<<elseif $playerInv.has("Mace")>>
<<if random(1,4) is 1>><<if $playerInv.count("Mace") is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv "Mace" 1>>
<<set $mes += "You block the attack with your Mace. ">>
<</if>>
<<elseif $playerInv.has("Spear")>>
<<if random(1,2) is 1>><<if $playerInv.count("Spear") is 1>><<set $weapon_broken to true>><</if>><<drop $playerInv "Spear" 1>>
<<set $mes += "You block the attack with your Spear. ">>
<</if>>
<</if>>
<</if>>
<!-- Aplica dano considerando modificadores -->
<<if !_aimed and $playerInv.hasAny($armor.list)>>
<<set $damage = Math.max(0, $damage - 1)>> <!-- Reduz dano por armadura -->
<<if $playerInv.has("Leather Armor")>><<if $playerInv.count("Leather Armor") is 1>><<set $armor_broken to true>><</if>><<drop $playerInv "Leather Armor" 1>><</if>>
<<if $playerInv.has("Chainmail")>><<if $playerInv.count("Chainmail") is 1>><<set $armor_broken to true>><</if>><<drop $playerInv "Chainmail" 1>><</if>>
<<if $playerInv.has("Plate Armor")>><<if $playerInv.count("Plate Armor") is 1>><<set $armor_broken to true>><</if>><<drop $playerInv "Plate Armor" 1>><</if>>
<</if>>
<<set $mes += $foe.name + " hits you with " + $weapon + ". You take " + $damage + " damage. ">>
<<set $health -= $damage>>
<<set $stamina -= $staminadamage>>
<<if $staminadamage > 0>><<set $mes += "You take " + $staminadamage + " stamina damage. ">><</if>>
<<if $stamina < 0>>
<<set $stamina to 0>>
<<set $knocked to true>>
<<set $mes += $foe.name + " knocks you back! ">>
<</if>>
<!-- Efeito Knock (reduz 2 AP do inimigo) -->
<<if _knock is true>>
<<set $knocked to true>>
<<set $mes += $foe.name + " knocks you back! ">>
<</if>>
// Aplica o efeito Disarm (remove arma do jogador)
<<set _playerWeapon = "">>
<<if _disarm and $playerInv.hasAny($allWeapons.list)>>
<<for _item range $playerInv.list>>
<<if $allWeapons.has(_item)>>
<<set _playerWeapon = _item>>
<<break>>
<</if>>
<</for>>
<<if _playerWeapon neq "">>
<<transfer $playerInv $droppedList _playerWeapon $playerInv.count(_playerWeapon)>>
<<set $mes += $foe.name + " disarms you, making you drop your " + _playerWeapon + "! ">>
<<set _disarm to false>>
<</if>>
<</if>>
<!-- Dedução de recursos do inimigo -->
<<set $foe.actionPoints -= $apcost>>
<<set $foe.stamina -= $staminacost>>
<<switch $skillType>>
<<case "Melee">>
<<if random(1, 4) is 1>><<if $foe.inv.count($weapon) is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv $weapon 1>><</if>>
<<case "Versatile">>
<<if random(1, 3) is 1>><<if $foe.inv.count($weapon) is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv $weapon 1>><</if>>
<<case "Archery">>
<<if random(1, 2) is 1>><<if $foe.inv.count($weapon) is 1>><<set $enemy_weapon_broken to true>><</if>><<drop $foe.inv $weapon 1>><</if>>
<</switch>>
//Aviso de equipamento quebrado
<<if $enemy_weapon_broken>><<set $mes += $foe.name + " weapon is broken! ">><</if>>
<<if $weapon_broken>><<set $mes += "Your weapon is broken! ">><</if>>
<<if $_shield_broken>><<set $mes += "Your shield is broken! ">><</if>>
<<if $_armor_broken>><<set $mes += "Your armor is broken! ">><</if>>
<!-- Se o jogador morrer -->
<<if $health <= 0>>
<<set $mes += "You have been defeated! ">>
<</if>>
<<else>>
<<set $mes += "You dodged the attack! ">>
<</if>>
<<else>>
<<set $mes += $foe.name + " missed the attack! ">>
<</if>>
<!-- Se o ataque foi de arremesso, a arma é jogada fora -->
<<if _throwWeapon>>
<<transfer $foe.inv $droppedList $weapon $foe.inv.count($weapon)>>
<</if>>
<<else>>
<<set $mes += $foe.name + " hesitates, lacking the energy to attack. ">>
<</if>>
<<set $actionPoints to $maxActionPoints>>
<<if $knocked>><<set $actionPoints to 0>><<set $knocked to false>><</if>>
<<redo>>
<</silent>>
<</widget>>
<<silent>>
<<dropall $playerSkill>>
<<switch $background>>
<<case "Gladiator">>
<<set $health = 4>>
<<set $stamina = 5>>
<<set $reputation = 0>>
<<set $actionPoints = 3>>
<<pickup $playerSkill "Melee" 2>>
<<set $gearCount = 2>>
<<set $chooseCombatSkills = false>>
<<set $description = "Trained fighter well-prepared for the brutality of the pits.">>
<<case "Brawler">>
<<set $health = 5>>
<<set $stamina = 5>>
<<set $reputation = 0>>
<<set $actionPoints = 3>>
<<pickup $playerSkill "Unarmed" 1 "Versatile" 1>>
<<set $gearCount = 1>>
<<set $chooseCombatSkills = false>>
<<set $description = "An experienced and strong fighter from the rough streets.">>
<<case "Noble">>
<<set $health = 3>>
<<set $stamina = 5>>
<<set $reputation = 0>>
<<set $actionPoints = 4>>
<<pickup $playerSkill "Archery" 1>>
<<set $gearCount = 3>>
<<set $chooseCombatSkills = false>>
<<set $description = "A former member of the upper class.">>
<<case "Mercenary">>
<<set $health = 4>>
<<set $stamina = 5>>
<<set $reputation = 0>>
<<set $actionPoints = 3>>
<<set $gearCount = 2>>
<<set $chooseCombatSkills = true>>
<<set $description = "A battle-hardened warrior, skilled in various forms of combat.">>
<</switch>>
<</silent>>\
<center><h2>$background</h2></center>
$description
''Health'': $health
''Stamina'': $stamina
''Action Points'': $actionPoints
''Skills'': <<if $chooseCombatSkills>>Choose 2<<else>><<= $playerSkill.list>><</if>>
''Gear'': $gearCount
<<link "Confirm Background">><<if $chooseCombatSkills>><<goto "Skills">><<else>><<goto "Motivation">><</if>><</link>>
[[Back|Create Fighter]]<<silent>>
<<switch $fightMode>>
<<case "Duel">>
<<set $description = "A common one-on-one fight. A reliable way to earn gold and maintain your reputation.">>
<<case "Skirmish">>
<<set $description = "A brutal battle that brings in more gold, but less reputation.">>
<<case "Champion">>
<<set $description = "A duel against a renowned opponent. Winning brings less gold but earns more reputation.">>
<</switch>>
<</silent>>\
<center><h2>$fightMode</h2></center>
$description
[[Confirm event|StartEvent]]
[[Back|Select Event]]<<silent>>
<<switch $fightMode>>
<<case "Duel">>
<<set $description = "A balanced one-on-one fight. Defeat your opponent by reducing their health to zero or forcing them to surrender.">>
<<case "Skirmish">>
<<set $description = "A lower-risk duel with fewer rewards. A good choice for cautious fighters.">>
<<case "Champion">>
<<set $description = "A high-stakes duel against a formidable opponent. Greater risks come with greater rewards.">>
<</switch>>
<</silent>>\
<center><h2>$fightMode</h2></center>
$description
[[Confirm fight|StartFight]]
[[Back|Choose Fight]]<<silent>>
<<set $fighterName = $characterData.name>>
<<set $background = $characterData.background>>
<<set $health = $characterData.health>>
<<set $maxHealth = $characterData.health>>
<<set $stamina = $characterData.stamina>>
<<set $maxStamina = $characterData.stamina>>
<<set $reputation = $characterData.reputation>>
<<set $actionPoints = $characterData.actionPoints>>
<<set $maxActionPoints = $characterData.actionPoints>>
<<set $playerSkill = $characterData.playerSkill>>
<<set $motivation = $characterData.motivation>>
<<set $playerInv = $characterData.playerInv>>
<<set $level = $characterData.level>>
<<set $caption to true>>
<<goto "Choose Fight">>
<</silent>>\<<silent>>
<<set $health = $maxHealth>>
<<set $stamina = $maxStamina>>
<<set $actionPoints = $maxActionPoints>>
<<set $level += 1>>
<!-- Encontrar o índice correto do personagem na lista -->
<<for _i, _char range $characterList>>\
<<if _char.name is $fighterName>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
<!-- Atualizar os dados do personagem existente -->
<<set $characterList[_index].background = $background>>
<<set $characterList[_index].health = $health>>
<<set $characterList[_index].stamina = $stamina>>
<<set $characterList[_index].actionPoints = $actionPoints>>
<<set $characterList[_index].level = $level>>
<<set $characterList[_index].reputation = $reputation>>
<<set $characterList[_index].playerSkill = $playerSkill>>
<<set $characterList[_index].motivation = $motivation>>
<<set $characterList[_index].playerInv = $playerInv>>
<!-- Salvar lista atualizada -->
<<run memorize('characterList', $characterList)>>
<<if $level >= 10 and !$achievement[0]>>
<<set $achievement[0] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''Arena Champion''<</notify>>
<</if>>
<<if $reputation >= 10 and !$achievement[1]>>
<<set $achievement[1] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''Living Legend''<</notify>>
<</if>>
<<goto "Choose Fight">>
<</silent>>
<<silent>>
<<switch $motivation>>
<<case "Glory">>
<<set $description = "Driven by a desire for fame and recognition. Reputation +1 on victory.">>
<<case "Wealth">>
<<set $description = "Focused on accumulating riches through successful fights and sponsorships. Higher chance to get gears on victory.">>
<<case "Revenge">>
<<set $description = "Seeking to avenge a personal grievance or wrong. Higher chance to get stamina on victory.">>
<<case "Survival">>
<<set $description = "Fighting to escape poverty or a dangerous past. Higher chance to get health victory.">>
<</switch>>
<</silent>>\
<center><h2>$motivation</h2></center>
$description
[[Confirm Motivation|Gear]]
[[Back|Motivation]]<center><h2>Create Fighter</h2></center>
Select your background:
[[Gladiator|Confirm Background][$background to "Gladiator"]] \
[[Brawler|Confirm Background][$background to "Brawler"]] \
[[Noble|Confirm Background][$background to "Noble"]] \
[[Mercenary|Confirm Background][$background to "Mercenary"]]
<<link "Random Background">><<set $background = either("Gladiator", "Brawler", "Noble", "Mercenary")>><<goto "Confirm Background">><</link>>
[[Back|Select Fighter]]<<set $caption to false>>\
<center><h2>Credits</h2></center>
''Medieval Pits'' was created by Janos Biro, based on the TTRPG of the same name, also written by Janos Biro for the Indie TTRPG Generator Game Jam.
Additional code: Simple inventory and custom macros by Chapel.
Special thanks to: Karol, Luíza, Fred, Christian, Sayonara, Captain Majin and Kit Riemer.
[[My itchio|https://janosbiro.itch.io/]]
[[Back|Intro]]<<set $caption to false>>\
<center><h2>Delete Fighter</h2></center>
<<for _i, _char range $characterList>>\
<<if _char.name is $sel.name>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
''$characterList[_index].name was deleted.''
<<set $characterList.deleteAt(_index)>>\
<<run memorize('characterList', $characterList)>>\
[[Back|Select Fighter]]<<for _i, _char range $fighters>>
<<if _char.name is $fighterName>>
<<set _index = _i>>
<<break>>
<</if>>
<</for>>
<<set $fighters.deleteAt(_index)>>
<<for _a, _char range $masterList>>
<<if _char.name is $masterName>>
<<set _index = _a>>
<<break>>
<</if>>
<</for>>
<<set $masterList[_index] = {
name: $masterName,
gold: $gold,
reputation: $master_reputation,
fighters: $fighters
}>>
<<run memorize('masterList', $masterList)>>
<<set $masterName to $fighterName>>
<<set $gold to 50>>
<<set $master_reputation to 0>>
<<set $fighters to []>>
<<set $masterData = {
name: $masterName,
background: "Pit Master",
motivation: $motivation,
health: $maxHealth,
maxhealth: $maxHealth,
stamina: $maxStamina,
maxstamina: $maxStamina,
actionPoints: $maxActionPoints,
maxactionPoints: $maxActionPoints,
skill: $playerSkill,
inv: $playerInv,
level: $level,
reposition: false,
gold: $gold,
reputation: $master_reputation,
fighters: $fighters
}>>
<<set $masterList.push($masterData)>>
<<run memorize('masterList', $masterList)>>
<<set $game to "Pit Masters">>
<<if !$achievement[4]>>
<<set $achievement[4] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''The New Tyrant''<</notify>>
<</if>>
<<goto "Select Fighters">>
<<silent>>
<<switch $background>>
<<case "Noble">>
<<switch $motivation>>
<<case "Glory">><<set _deathMessage = "With a final, precise strike, you end the reign of the Pit Master. The crowd roars, and at last, your name will be remembered above all others." >>
<<case "Wealth">><<set _deathMessage = "The Pit Master collapses before you. His empire, his wealth—it’s all yours now. The strongest always claim the prize." >>
<<case "Revenge">><<set _deathMessage = "The Pit Master gasps his last breath, but your vengeance is already complete. Blood for blood, debt repaid in full." >>
<<case "Survival">><<set _deathMessage = "You stand over the fallen Pit Master, knowing it was always going to be him or you. Today, you live." >>
<</switch>>
<<case "Brawler">>
<<switch $motivation>>
<<case "Glory">><<set _deathMessage = "With a savage final blow, you silence the Pit Master forever. The pit is yours now, your legacy written in blood and grit." >>
<<case "Wealth">><<set _deathMessage = "The crowd watches in awe as the Pit Master falls. His riches, his influence, all of it is yours to claim." >>
<<case "Revenge">><<set _deathMessage = "Each punch, each strike, was a reckoning. As the Pit Master collapses, you know justice has been served your way." >>
<<case "Survival">><<set _deathMessage = "Another opponent down, another day to breathe. The Pit Master is dead, but survival never truly ends." >>
<</switch>>
<<case "Gladiator">>
<<switch $motivation>>
<<case "Glory">><<set _deathMessage = "The greatest fight ends with your victory. The arena belongs to you now, and history will never forget your name." >>
<<case "Wealth">><<set _deathMessage = "The Pit Master’s rule ends at your feet. His fortune and influence now belong to the strongest: you." >>
<<case "Revenge">><<set _deathMessage = "With each cut, each strike, you took back what was stolen. The Pit Master is no more, and your vengeance is fulfilled." >>
<<case "Survival">><<set _deathMessage = "You fought, you endured, and you won. That’s all survival has ever been." >>
<</switch>>
<<case "Mercenary">>
<<switch $motivation>>
<<case "Glory">><<set _deathMessage = "The contract is complete, the final battle won. This wasn’t just another job—this was your legend in the making." >>
<<case "Wealth">><<set _deathMessage = "The Pit Master’s rule ends in blood, and his wealth is now yours. Payment in full." >>
<<case "Revenge">><<set _deathMessage = "A job done well. The Pit Master is gone, and your vengeance has been earned." >>
<<case "Survival">><<set _deathMessage = "The strongest blade survives. Today, that blade was yours." >>
<</switch>>
<</switch>>
<<set $characterList = recall('characterList') ?? []>>
<<for _fighter range $fighters>>
<<set $characterList.push(_fighter)>>
<</for>>
<<run memorize('characterList', $characterList)>>
<<set $deathdate to new Date().toLocaleString()>>
<<set $masterData = {
name: $masterName,
background: $foe.background,
motivation: $foe.motivation,
health: $foe.maxhealth,
stamina: $foe.maxstamina,
reputation: $master_reputation,
actionPoints: $foe.actionPoints,
maxactionPoints: $foe.maxactionPoints,
playerSkill: $foe.skill,
playerInv: $foe.inv,
level: $foe.level,
death: $deathdate,
}>>
<<set $cemeteryList = recall('cemeteryList') ?? []>>
<<set $cemeteryList.push($masterData)>>
<<run memorize('cemeteryList', $cemeteryList)>>
<<for _i, _char range $masterList>>
<<if _char.name is $masterName>>
<<set _index = _i>>
<<break>>
<</if>>
<</for>>
<<set $masterList.deleteAt(_index)>>
<<run memorize('masterList', $masterList)>>
<<if !$achievement[5]>>
<<set $achievement[5] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''Freedom Fighter''<</notify>>
<</if>>
<</silent>>\
<center><h2>The end</h2></center>
<<print _deathMessage>>
<<link "Credits">><<goto "Credits">><</link>>
<<link "Play again">><<goto "Intro">><</link>>
<<set $characterData = { name: $sel.name, background: $sel.background, health: $sel.health, stamina: $sel.stamina, reputation: $sel.reputation, actionPoints: $sel.actionPoints, playerSkill: $sel.playerSkill, motivation: $sel.motivation, playerInv: $sel.playerInv, level: $sel.level }>>\
<center><h2>$characterData.name</h2></center>
Background: ''$characterData.background''
Level: ''$characterData.level''
Motivation: ''$characterData.motivation''
Health: ''$characterData.health''
Stamina: ''$characterData.stamina''
Reputation: ''$characterData.reputation''
Action Points: ''$characterData.actionPoints''
Skills: ''<<set _count = 0>><<for _item, _quantity range $characterData.playerSkill.table>>\
<<print _item + " " + _quantity>><<set _count += 1>><<if _count < $characterData.playerSkill.uniqueLength>>, <</if>><</for>>''
Gear: ''<<set _count = 0>><<for _item, _quantity range $characterData.playerInv.table>>\
<<print _item + "(" + _quantity+ ")">><<set _count += 1>><<if _count < $characterData.playerInv.uniqueLength>>, <</if>><</for>>''
[[Confirm Fighter]] [[Delete Fighter]]
[[Back|Select Fighter]]<center><h2>Finish Creation</h2></center>
<<set $level to 1>><<set $reputation to 0>>\
<<do>><<set $fighterName to either($firstNames)+" "+either($lastNames)>>\
Name your fighter: ''<<textbox "$fighterName" $fighterName autofocus>>''<</do>>
Background: ''$background''
Level: ''$level''
Motivation: ''$motivation''
Health: ''$health''
Stamina: ''$stamina''
Reputation: ''$reputation''
Action Points: ''$actionPoints''
Skills: ''<<set _count = 0>><<for _item, _quantity range $playerSkill.table>>\
<<print _item + " " + _quantity>><<set _count += 1>><<if _count < $playerSkill.uniqueLength>>, <</if>><</for>>''
Gear: ''<<set _count = 0>><<for _item, _quantity range $playerInv.table>>\
<<print _item + "(" + _quantity+ ")">><<set _count += 1>><<if _count < $playerInv.uniqueLength>>, <</if>><</for>>''
[[Confirm|Save Fighter]] \
<<link "Random Name">><<redo>><</link>>
[[Back|Gear]] <<link "Cancel">><<goto "Select Fighter">><</link>><<switch $background>><<case "Gladiator" "Mercenary">><<set $gearCount = 2>><<case "Brawler">><<set $gearCount = 1>><<case "Noble">><<set $gearCount = 3>><</switch>>\
<<dropall $playerInv>>\
<center><h2>Gear</h2></center>
Equipment wears down over time and may break during combat.
Choose $gearCount starting gear:
<<do>>\
<<if $gearCount > 0>>\
<<set _hasArmor = $playerInv.hasAny($armor.list)>>\
<<for _item, _data range $items>>\
<<capture _item _data>>\
<<if $gearCount > 0 and (_item is "Bandages" or _item is "Strong Brew" or (!$playerInv.has(_item) and (!$armor.has(_item) or !_hasArmor)))>>\
<<link _item>><<dialog _item>>\
_data.desc<br>
<<link "Confirm">><<pickup $playerInv _item _data.durability>><<set $gearCount -= 1>><<redo>><<dialogclose>><</link>> \
<<link "Back">><<dialogclose>><</link>>\
<</dialog>><</link>> \
<</if>>\
<</capture>>\
<</for>>
Chosen Gear: <<= $playerInv.list>>
<<else>>\
Chosen Gear: <<= $playerInv.list>>
<br>[[Confirm|Finish Creation]]
<</if>>\
<</do>>\
<!-- Random Gear Selection -->\
<<link "Random Gear">>\
<<dropall $playerInv>>\
<<switch $background>>\
<<case "Gladiator">>\
<<set _randomItem = either($meleeGear.list)>>\
<<pickup $playerInv _randomItem $meleeGear.count(_randomItem)>>\
<<set _randomItem = either($secondGear.list)>>\
<<pickup $playerInv _randomItem $secondGear.count(_randomItem)>>\
<<case "Brawler">>\
<<set _randomItem = either($brawlerGear.list)>>\
<<pickup $playerInv _randomItem $brawlerGear.count(_randomItem)>>\
<<case "Noble">>\
<<set _randomItem = either($archeryGear.list)>>\
<<pickup $playerInv _randomItem $archeryGear.count(_randomItem)>>\
<<set _randomItem = either($armor.list)>>\
<<pickup $playerInv _randomItem $armor.count(_randomItem)>>\
<<set _randomItem = either($itens.list)>>\
<<pickup $playerInv _randomItem $itens.count(_randomItem)>>\
<<case "Mercenary">>\
<<if $playerSkill.has('Melee')>>\
<<set _randomItem = either($meleeGear.list)>>\
<<pickup $playerInv _randomItem $meleeGear.count(_randomItem)>>\
<</if>>\
<<if $playerSkill.has('Archery')>>\
<<set _randomItem = either($archeryGear.list)>>\
<<pickup $playerInv _randomItem $archeryGear.count(_randomItem)>>\
<</if>>\
<<if $playerSkill.has('Versatile')>>\
<<set _randomItem = either($versatileGear.list)>>\
<<pickup $playerInv _randomItem $versatileGear.count(_randomItem)>>\
<</if>>\
<<if $playerSkill.has('Unarmed')>>\
<<set _randomItem = either($unarmedGear.list)>>\
<<pickup $playerInv _randomItem $unarmedGear.count(_randomItem)>>\
<</if>>\
<</switch>>\
<<set $gearCount = 0>>\
<<redo>>\
<</link>> \
[[Clear|Gear]]
[[Back|Motivation]]<center><h2>Gear</h2></center>
Equipment wears down over time and may break during combat.
Choose a gear:
<<set _hasArmor = $playerInv.hasAny($armor.list)>>\
<<for _item, _data range $items>>\
<<capture _item _data>>\
<<if (_item is "Bandages" or _item is "Strong Brew" or (!$playerInv.has(_item) and (!$armor.has(_item) or !_hasArmor)))>>\
<<link _item>>
<<dialog _item>>\
_data.desc<br>
<<link "Confirm">>
<<pickup $playerInv _item _data.durability>>
<<goto "Confirm Level up">>
<<dialogclose>>
<</link>>
<<link "Back">>
<<dialogclose>>
<</link>>\
<</dialog>>
<</link>> \
<</if>>\
<</capture>>\
<</for>><center><h2>Skill</h2></center>\
Choose a skill:
<<for _skillName, _skillDesc range $skills>>\
<<if $playerSkill.count(_skillName) < 5>>\
<<capture _skillName _skillDesc>>\
<<link _skillName>>
<<dialog _skillName>>\
<<print _skillDesc>><br>\
<<link "Confirm">>\
<<pickup $playerSkill _skillName 1>>
<<goto "Confirm Level up">>
<<dialogclose>>
<</link>>
<<link "Back">>
<<dialogclose>>
<</link>>\
<</dialog>>
<</link>> \
<</capture>>\
<</if>>\
<</for>>
<<if $playerSkill.count() >= 20>>\
All skills are at maximum level! How did you do that?
<<link "Confirm">>\
<<set $reputation += 1>>
<<goto "Confirm Level up">>
<</link>>
<</if>>\<<set $game to "Medieval Pits">><<set $caption to false>>\
<center><h1>Medieval Pits</h1></center>
In the underground of a vast medieval city lies a world of brutal combat, treacherous alliances, and unyielding ambition. Deep beneath the city streets, the ancient catacombs serve as the battleground for the ruthless fighting pits. Will you rise or fall into the shadows?
[[Pit Fighters][$game to "Pit Fighters"]] [[Pit Masters][$game to "Pit Masters"]] [[Pit Rats][$game to "Pit Rats"]]
[[About]] [[Credits]] [[Guide]] [[Cemetery]] [[Achievements]] \
<<link "Reset">>\
<<dialog "Confirm Reset">>\
Are you sure you want to delete all character data? This action cannot be undone. Your saves and achievements will not be deleted.
<<link "Reset">>\
<<run forget('masterList')>>\
<<run forget('cemeteryList')>>\
<<run forget('characterList')>>\
<<run UI.alert("Character data deleted.");>>
<</link>> \
<<link "Cancel">><<dialogclose>><</link>>\
<</dialog>>\
<</link>>\<center><h2>Level up</h2></center>
<<switch $reputation>>\
<<case 0>>The crowd barely acknowledges your victory. A few scattered boos and murmurs of indifference fill the arena.
<<case 1>>A handful of spectators grunt in vague approval, but most turn away, already focused on the next fight.
<<case 2>>Some in the crowd nod in respect, while others scoff, unimpressed by your performance.
<<case 3>>Your name is spoken here and there. A few cheers rise from the stands, though many remain indifferent.
<<case 4>>A solid applause greets your victory. You're starting to make an impression.
<<case 5>>Chants of your name ripple through the arena. People are beginning to take sides—some love you, some want to see you fall.
<<case 6>>The crowd roars as you stand victorious. Bets are placed on your next match before your opponent even hits the ground.
<<case 7>>Your victories draw frenzied excitement. Merchants sell crude effigies of you, and your fights become the highlight of the day.
<<case 8>>The audience erupts into deafening cheers, throwing coins and flowers into the pit. You are becoming a legend.
<<case 9>>Your very presence electrifies the arena. Nobles and warlords whisper your name, and songs are sung of your battles.
<<default>>The crowd is in a frenzy. They scream your name as if calling upon a god of war. Statues will be built in your honor, and your victories will be remembered for generations.
<</switch>>\
<<silent>>\
<<set _event to "">>
<<set _totalRank to $reputation + $level>>
<<switch $background>>
<<case "Gladiator">>
<<switch $motivation>>
<<case "Glory">>
<<if _totalRank >= 15>>
<<set _event to "You roll your shoulders and glance towards the overseer's box. 'No more pretenders. It's time for the real fight.' The Pit Master won’t be able to ignore you much longer." >>
<<else>>
<<set _event to "You wipe the blood from your blade and smirk. 'Another step toward legend.' You mutter, rolling your shoulders and preparing for the next fight." >>
<</if>>
<<case "Wealth">>
<<if _totalRank >= 15>>
<<set _event to "You count your winnings but barely acknowledge the gold. 'This isn’t about money anymore. It’s about taking what’s mine.' The Pit Master’s rule is nearly over." >>
<<else>>
<<set _event to "You shake the fatigue from your limbs and glance at the bookkeeper. 'Hope the purse is heavy enough for all this trouble,' you say, already thinking about your next bet." >>
<</if>>
<<case "Revenge">>
<<if _totalRank >= 15>>
<<set _event to "You press your boot against your fallen opponent and scan the arena. 'Enough distractions. The one I seek is within reach.' The Pit Master’s time is up." >>
<<else>>
<<set _event to "You crouch beside your fallen opponent, gripping your weapon tightly. 'Not the one I truly seek... but close enough for now.' You whisper before standing." >>
<</if>>
<<case "Survival">>
<<if _totalRank >= 15>>
<<set _event to "You inhale deeply and glance toward the Pit Master's chambers. 'No more running. No more hiding. If I want to live, I have to end this myself.'" >>
<<else>>
<<set _event to "You take a slow, steady breath, feeling the sting of fresh wounds. 'Live today, fight tomorrow,' you mutter, stepping away from the bloodied sand." >>
<</if>>
<</switch>>
<<case "Brawler">>
<<switch $motivation>>
<<case "Glory">>
<<if _totalRank >= 15>>
<<set _event to "You crack your knuckles and grin. 'Time to see if the big boss can take a punch.' The Pit Master won’t be able to hide behind their fighters much longer." >>
<<else>>
<<set _event to "You crack your knuckles and spit on the ground. 'Who's next?' you bark, adrenaline still rushing through your veins." >>
<</if>>
<<case "Wealth">>
<<if _totalRank >= 15>>
<<set _event to "You flip a coin in the air and catch it. 'I’ve made them rich enough. Now it's time to take my real prize.' The Pit Master will pay in more than gold." >>
<<else>>
<<set _event to "You roll your neck and grin. 'Drinks on me... once I get paid.' You pat yourself down, checking if you lost any coin in the scuffle." >>
<</if>>
<<case "Revenge">>
<<if _totalRank >= 15>>
<<set _event to "You stretch out your fists, but your mind is already elsewhere. 'No more small fights. It’s time to break the head of the beast.' The Pit Master is next." >>
<<else>>
<<set _event to "You step over the groaning body of your opponent. 'That one wasn’t even personal,' you scoff, shaking the tension from your fists." >>
<</if>>
<<case "Survival">>
<<if _totalRank >= 15>>
<<set _event to "You roll your shoulders and shake off the pain. 'If I don’t take them out now, I’ll never leave this pit alive.' The final fight is coming." >>
<<else>>
<<set _event to "You stretch out your sore limbs and exhale. 'Still breathing. That’s all that matters.'" >>
<</if>>
<</switch>>
<<case "Noble">>
<<switch $motivation>>
<<case "Glory">>
<<if _totalRank >= 15>>
<<set _event to "You adjust your posture and glance toward the highest seat in the arena. 'I have proven myself. Now, I take my rightful place.' The Pit Master’s rule must end." >>
<<else>>
<<set _event to "You sheathe your weapon with precision and adjust your stance. 'The art of combat is alive in me,' you murmur, flicking away a stray drop of blood from your glove." >>
<</if>>
<<case "Wealth">>
<<if _totalRank >= 15>>
<<set _event to "You brush off your armor and watch the pit handlers from a distance. 'If power can be bought, I will claim it.' The Pit Master’s fortune should belong to you." >>
<<else>>
<<set _event to "You straighten your posture and adjust your attire. 'Fortune favors those who endure,' you say, already planning your next investment." >>
<</if>>
<<case "Revenge">>
<<if _totalRank >= 15>>
<<set _event to "You flex your grip around your weapon. 'This isn’t about fighting anymore. This is about justice.' The Pit Master will answer for everything." >>
<<else>>
<<set _event to "You press a boot against your downed opponent, staring for a moment. 'Not the one I seek, but a necessary lesson nonetheless,' you murmur before stepping away." >>
<</if>>
<<case "Survival">>
<<if _totalRank >= 15>>
<<set _event to "You shake the dust from your armor and glance at the gates leading to the Master’s chambers. 'There’s no future for me unless I take it myself.'" >>
<<else>>
<<set _event to "You brush dust from your sleeves, ignoring the ache in your limbs. 'I was never meant for this life,' you sigh, 'yet here I am.'" >>
<</if>>
<</switch>>
<<case "Mercenary">>
<<switch $motivation>>
<<case "Glory">>
<<if _totalRank >= 15>>
<<set _event to "You wipe sweat from your brow and smirk. 'The real contract starts now.' The Pit Master is your next target." >>
<<else>>
<<set _event to "You wipe sweat from your brow and smirk. 'Another contract fulfilled. Another story for the songs.' You nod to yourself, already looking for the next job." >>
<</if>>
<<case "Wealth">>
<<if _totalRank >= 15>>
<<set _event to "You adjust your belt, feeling the weight of your winnings. 'One last job, one last payday. Then, I take everything.'" >>
<<else>>
<<set _event to "You kneel for a moment to check the fallen opponent’s belt for valuables. 'Gold spends the same, no matter who bleeds for it,' you remark, pocketing a small trinket." >>
<</if>>
<<case "Revenge">>
<<if _totalRank >= 15>>
<<set _event to "You stare at your next opponent, but your mind is already ahead. 'The fight I trained for is finally here.' The Pit Master will fall." >>
<<else>>
<<set _event to "You stand over your fallen enemy, your expression unreadable. 'Every fight is practice for the one that truly matters,' you murmur before turning away." >>
<</if>>
<<case "Survival">>
<<if _totalRank >= 15>>
<<set _event to "You exhale sharply and tighten your grip. 'No more contracts. No more games. I end this, or I die here.'" >>
<<else>>
<<set _event to "You shake off the pain, glancing at the next group of fighters waiting their turn. 'Another fight, another day above ground,' you mutter before stepping away." >>
<</if>>
<</switch>>
<</switch>>
<</silent>>\
<<print _event>>
Select an upgrade:
<<silent>>\
<<if $fightMode is "Duel" >><<set $reputation += 1>><</if>>
<<if $fightMode is "Champion" >><<set $reputation += 2>><</if>>
<<set $gear_upgrade to ($playerInv.uniqueLength * 2) - 2>>
<<set $stamina_upgrade to ($maxStamina * 3) - 12>>
<<set $health_upgrade to ($maxHealth * 4) - 12>>
<<set $skill_upgrade to ($playerSkill.length * 2) - 2>>
<<set $ap_upgrade to ($maxActionPoints * 4) - 8>>
<<if $motivation is "Glory">><<set $reputation += 1>><</if>>
<<if $motivation is "Wealth">><<set $gear_upgrade to $playerInv.uniqueLength>><</if>>
<<if $motivation is "Revenge">><<set $stamina_upgrade to ($maxStamina * 2) - 8>><</if>>
<<if $motivation is "Survival">><<set $health_upgrade to ($maxHealth * 3) - 10>><</if>>
<!-- Define as opções de upgrade disponíveis com base na reputação -->
<</silent>>\
<<link "Reputation">>
<<set $reputation += 1>>
<<goto "Confirm Level up">>
<</link>> \
<<if $reputation >= $gear_upgrade>>\
<<link "Gear">>
<<goto "Get_Gear">>
<</link>> \
<</if>>\
<<if $reputation >= $skill_upgrade>>\
<<link "Skill">>
<<goto "Get_Skill">>
<</link>> \
<</if>>\
<<if $reputation >= $stamina_upgrade>>\
<<link "Stamina">>
<<set $maxStamina += 1>>
<<goto "Confirm Level up">>
<</link>> \
<</if>>\
<<if $reputation >= $health_upgrade>>\
<<link "Health">>
<<set $maxHealth += 1>>
<<goto "Confirm Level up">>
<</link>> \
<</if>>\
<<if $reputation >= $ap_upgrade>>\
<<link "Action Points">>
<<set $maxActionPoints += 1>>
<<goto "Confirm Level up">>
<</link>> \
<</if>>\<center><h2>Loot</h2></center>
You stand over the fallen thug, catching your breath. As the dust settles, you rummage through their belongings, searching for anything useful.
<<do>>\
<<set _hasArmor = $playerInv.hasAny($armor.list)>>\
<<for _item, _data range $items>>\
<<capture _item _data>>\
<<if $foe.inv.has(_item) and (_item is "Bandages" or _item is "Strong Brew" or (!$playerInv.has(_item) and (!$armor.has(_item) or !_hasArmor)))>>\
<<link _item>><<dialog _item>>\
_data.desc<br>
<<link "Confirm">><<transfer $foe.inv $playerInv _item $foe.inv.count(_item)>><<redo>><<dialogclose>><</link>> \
<<link "Back">><<dialogclose>><</link>>\
<</dialog>><</link>>\
<</if>>\
<</capture>>\
<</for>>
<<link "Continue">><<set $combat to false>><<set $step += 1>><<set $mes to "You gather your spoils and move on, the path ahead waiting to test you once more.">><<goto "Tunnels">><</link>>
<</do>><center><h2>Motivation</h2></center>
Choose motivation:
[[Glory|Confirm Motivation][$motivation = "Glory"]] \
[[Wealth|Confirm Motivation][$motivation = "Wealth"]] \
[[Revenge|Confirm Motivation][$motivation = "Revenge"]] \
[[Survival|Confirm Motivation][$motivation = "Survival"]]
<<link "Random Motivation">><<set $motivation = either("Glory", "Wealth", "Revenge", "Survival")>><<goto "Confirm Motivation">><</link>>
[[Back|Confirm Background]]<<set $caption to false>>\
<center><h2>Pit Fighters</h2></center>
Engage in tactical combat in Duel, Skirmish or Champion Challenge. Survive to become a legend.
[[Start|Select Fighter]]
[[Back|Intro]]<<set $caption to false>>\
<center><h2>Pit Masters</h2></center>
Step into the role of a cunning entrepreneur, managing your own fighting pit.
[[Start|Select Master]]
[[Back|Intro]]<<set $caption to false>>\
<center><h2>Pit Rats</h2></center>
Navigate the dangerous tunnels beneath the city to confront the Pit Master.
[[Start|Select Master 2]]
[[Back|Intro]]<<widget "random">>\
<<silent>>
<<set $background = either("Gladiator", "Brawler", "Noble", "Mercenary")>>
<<set $motivation = either("Glory", "Wealth", "Revenge", "Survival")>>
<<dropall $playerSkill>>
<<dropall $playerInv>>
<<switch $background>>
<<case "Gladiator">>
<<set $health = 4>>
<<set $stamina = 5>>
<<set $actionPoints = 3>>
<<pickup $playerSkill "Melee" 2>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $playerInv _randomItem $meleeGear.count(_randomItem)>>
<<set _randomItem = either($secondGear.list)>>
<<pickup $playerInv _randomItem $secondGear.count(_randomItem)>>
<<case "Brawler">>
<<set $health = 5>>
<<set $stamina = 5>>
<<set $actionPoints = 3>>
<<pickup $playerSkill "Unarmed" 1 "Versatile" 1>>
<<set _randomItem = either($brawlerGear.list)>>
<<pickup $playerInv _randomItem $brawlerGear.count(_randomItem)>>
<<case "Noble">>
<<set $health = 3>>
<<set $stamina = 5>>
<<set $actionPoints = 4>>
<<pickup $playerSkill "Archery" 1>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $playerInv _randomItem $archeryGear.count(_randomItem)>>
<<set _randomItem = either($armor.list)>>
<<pickup $playerInv _randomItem $armor.count(_randomItem)>>
<<set _randomItem = either($itens.list)>>
<<pickup $playerInv _randomItem $itens.count(_randomItem)>>
<<case "Mercenary">>
<<set $health = 4>>
<<set $stamina = 5>>
<<set $actionPoints = 3>>
<<set _randomSkill = either($allSkills.list)>>
<<pickup $playerSkill _randomSkill 1>>
<<set _randomSkill = either($allSkills.list)>>
<<pickup $playerSkill _randomSkill 1>>
<!-- Escolhe equipamento com base na habilidade -->
<<if $playerSkill.has('Melee')>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $playerInv _randomItem $meleeGear.count(_randomItem)>>
<</if>>
<<if $playerSkill.has('Archery')>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $playerInv _randomItem $archeryGear.count(_randomItem)>>
<</if>>
<<if $playerSkill.has('Versatile')>>
<<set _randomItem = either($versatileGear.list)>>
<<pickup $playerInv _randomItem $versatileGear.count(_randomItem)>>
<</if>>
<<if $playerSkill.has('Unarmed')>>
<<set _randomItem = either($unarmedGear.list)>>
<<pickup $playerInv _randomItem $unarmedGear.count(_randomItem)>>
<</if>>
<</switch>>
<</silent>>\
<</widget>>
<<widget "rndnpc">>\
<<silent>>\
<<set $npcLevel = _args[0]>>
<<set $npcName = either($firstNames) + " " + either($lastNames)>>
<<set $npcBackground = either("Gladiator", "Brawler", "Noble", "Mercenary")>>
<<set $npcMotivation = either("Glory", "Wealth", "Revenge", "Survival")>>
<<dropall $npcSkill>>
<<dropall $npcInv>>
<<switch $npcBackground>>
<<case "Gladiator">>
<<set $npcHealth = 4>>
<<set $npcStamina = 5>>
<<set $npcActionPoints = 3>>
<<pickup $npcSkill "Melee" 2>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $npcInv _randomItem $meleeGear.count(_randomItem)>>
<<set _randomItem = either($secondGear.list)>>
<<pickup $npcInv _randomItem $secondGear.count(_randomItem)>>
<<case "Brawler">>
<<set $npcHealth = 5>>
<<set $npcStamina = 5>>
<<set $npcActionPoints = 3>>
<<pickup $npcSkill "Unarmed" 1 "Versatile" 1>>
<<set _randomItem = either($brawlerGear.list)>>
<<pickup $npcInv _randomItem $brawlerGear.count(_randomItem)>>
<<case "Noble">>
<<set $npcHealth = 3>>
<<set $npcStamina = 5>>
<<set $npcActionPoints = 4>>
<<pickup $npcSkill "Archery" 1>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $npcInv _randomItem $archeryGear.count(_randomItem)>>
<<set _randomItem = either($armor.list)>>
<<pickup $npcInv _randomItem $armor.count(_randomItem)>>
<<set _randomItem = either($itens.list)>>
<<pickup $npcInv _randomItem $itens.count(_randomItem)>>
<<case "Mercenary">>
<<set $npcHealth = 4>>
<<set $npcStamina = 5>>
<<set $npcActionPoints = 3>>
<<set _randomSkill = either($allSkills.list)>>
<<pickup $npcSkill _randomSkill 1>>
<<set _randomSkill = either($allSkills.list)>>
<<pickup $npcSkill _randomSkill 1>>
<!-- Escolhe equipamento com base na habilidade -->
<<if $npcSkill.has('Melee')>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $npcInv _randomItem $meleeGear.count(_randomItem)>>
<</if>>
<<if $npcSkill.has('Archery')>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $npcInv _randomItem $archeryGear.count(_randomItem)>>
<</if>>
<<if $npcSkill.has('Versatile')>>
<<set _randomItem = either($versatileGear.list)>>
<<pickup $npcInv _randomItem $versatileGear.count(_randomItem)>>
<</if>>
<<if $npcSkill.has('Unarmed')>>
<<set _randomItem = either($unarmedGear.list)>>
<<pickup $npcInv _randomItem $unarmedGear.count(_randomItem)>>
<</if>>
<</switch>>
<!-- Loop to adjust the level -->
<<for _level = 2; _level <= $npcLevel; _level++>>
<<set _upgrade = either(
"Reputation",
"Gear",
"Skill",
"Health",
"Stamina",
"Action Points"
)>>
<<switch _upgrade>>
<<case "Reputation">>
<<case "Gear">>
<!-- Escolhe equipamento com base na habilidade -->
<<if $npcSkill.has('Melee') and !$npcInv.hasAny($meleeGear.list)>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $npcInv _randomItem $meleeGear.count(_randomItem)>>
<<elseif $npcSkill.has('Archery') and !$npcInv.hasAny($archeryGear.list)>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $npcInv _randomItem $archeryGear.count(_randomItem)>>
<<elseif !$npcInv.hasAny($armor.list)>>
<<set _randomItem = either($armor.list)>>
<<pickup $npcInv _randomItem $armor.count(_randomItem)>>
<<elseif !$npcInv.has('Bandages')>>
<<pickup $npcInv "Bandages" 2>>
<<elseif !$npcInv.has('Strong Brew')>>
<<pickup $npcInv "Strong Brew" 2>>
<<elseif !$npcInv.has('Shield')>>
<<pickup $npcInv "Shield" 2>>
<<else>>
<<set _level -= 1>>
<</if>>
<<case "Skill">>
<<set _newSkill to either($allSkills.list)>>
<<if $npcSkill.count(_newSkill) < 5>>
<<pickup $npcSkill _newSkill 1>>
<<else>>
<<set _level -= 1>>
<</if>>
<<case "Health">>
<<set $npcHealth += 1>>
<<case "Stamina">>
<<set $npcStamina += 1>>
<<case "Action Points">>
<!-- Check if the level is 4 or higher -->
<<if _level >= 4>>
<!-- If the NPC is a Noble, they have +1 to the max AP -->
<<if $npcBackground == "Noble">>
<<if _level < 7 and $npcActionPoints < 5>>
<<set $npcActionPoints += 1>>
<<elseif _level >= 7 and $npcActionPoints < 6>>
<<set $npcActionPoints += 1>>
<<else>>
<<set _level -= 1>>
<</if>>
<!-- Non-Noble characters -->
<<else>>
<<if _level < 7 and $npcActionPoints < 4>>
<<set $npcActionPoints += 1>>
<<elseif _level >= 7 and $npcActionPoints < 5>>
<<set $npcActionPoints += 1>>
<<else>>
<<set _level -= 1>>
<</if>>
<</if>>
<<else>>
<<set _level -= 1>>
<</if>>
<</switch>>
<</for>>
<<set $npcMaxHealth to $npcHealth>>
<<set $npcMaxStamina to $npcStamina>>
<<set $npcMaxActionPoints to $npcActionPoints>>
<</silent>>
<</widget>>
<<widget "Reaction">>\
<<switch $master_reputation>>\
<<case -5>>Your name is cursed in the streets. No fighter wants to be associated with you, and the arena masters are considering banning you from organizing matches.
<<case -4>>Whispers of rigged fights and treachery surround you. Bettors avoid your events, and even lowly fighters hesitate to take your coin.
<<case -3>>Spectators watch your matches with suspicion, expecting foul play. The arena takes a larger cut of your earnings to "ensure fairness."
<<case -2>>Your fighters are given the worst matchups, and the arena officials don’t hide their contempt. Sponsorships and favors are out of the question.
<<case -1>>Fighters under your banner are seen as desperate or dishonorable. You struggle to get good matchups, and prize money is often reduced.
<<case 0>>You're just another nameless handler. Your events proceed without fanfare, and the arena pays you the bare minimum.
<<case 1>>A few fighters are willing to work with you, but they expect fair pay. The crowd doesn’t care much for your matches yet.
<<case 2>>Your reputation as a competent master grows. Fighters join your ranks with some confidence, and bets on your events begin to increase.
<<case 3>>Your name is recognized among the lower ranks. The arena offers slightly better cuts, and traders take an interest in your fighters.
<<case 4>>People start attending your matches just to see what your fighters will do next. The arena offers better match placements, and gold flows more easily.
<<case 5>>Your stable of fighters is well-respected. Merchants seek your favor, and wealthier patrons begin placing heavy bets on your matches.
<<case 6>>The arena masters acknowledge your influence. You gain access to better match arrangements, and even nobility takes notice of your fighters.
<<case 7>>Your fighters are given priority in high-stakes events. Warlords and merchants offer sponsorships, and the best recruits seek you out.
<<case 8>>You wield power over the arena itself. Favors from officials, access to elite fights, and lucrative deals come naturally.
<<case 9>>Rulers and generals seek your fighters for their own games and wars. The arena bends to your will, and lesser pit masters treat you with reverence.
<<default>>Your name is carved into the stones of the arena. Your matches dictate the flow of gold in the city, and you are as much a legend as the fighters you command.
<</switch>>\
<</widget>><<silent>>
<<set $characterData = {
name: $fighterName,
background: $background,
health: $health,
stamina: $stamina,
reputation: $reputation,
actionPoints: $actionPoints,
playerSkill: $playerSkill,
motivation: $motivation,
playerInv: $playerInv,
level: $level,
}>>
<<set $sel = $characterData>>
<<set $characterList.push($characterData)>>
<<run memorize('characterList', $characterList)>>
<<goto "Confirm Fighter">>
<</silent>>\<center><h2>Select Event</h2></center>
Select an event in the pits:
[[Duel|Confirm Event][$fightMode to "Duel"]] \
[[Skirmish|Confirm Event][$fightMode to "Skirmish"]] \
[[Champion|Confirm Event][$fightMode to "Champion"]]
[[Back|Select Fighters]]<<set $caption to false>>\
<center><h2>Select Fighter</h2></center>
<<set $characterList = recall('characterList') ?? []>>\
<<if $characterList.length > 0>>\
<<for _charData range $characterList>>\
<<capture _charData>>\
<<set $characterData = { name: _charData.name, background: _charData.background, health: _charData.health, stamina: _charData.stamina, reputation: _charData.reputation, actionPoints: _charData.actionPoints, playerSkill: _charData.playerSkill, motivation: _charData.motivation, playerInv: _charData.playerInv, level: _charData.level }>>\
<<link '_charData.name (_charData.background _charData.level)'>><<set $sel = _charData>><<goto "Fighter Details">><</link>> \
<</capture>>\
<</for>>\
<<else>>\
There are no saved fighters.
<</if>>
[[Create Fighter]] \
<<link "Random Fighter">><<random>><<goto "Finish Creation">><</link>>
[[Back|Pit Fighters]]<<set $caption to false>>\
<center><h2>Select Fighter</h2></center>
<<if $fighters.length > 0>>\
<<for _charData range $fighters>>\
<<capture _charData>>\
<<set $characterData = { name: _charData.name, background: _charData.background, health: _charData.health, stamina: _charData.stamina, reputation: _charData.reputation, actionPoints: _charData.actionPoints, playerSkill: _charData.playerSkill, motivation: _charData.motivation, playerInv: _charData.playerInv, level: _charData.level }>>\
<<link '_charData.name (_charData.background _charData.level)'>>\
<<set $fighterName = _charData.name>>
<<set $background = _charData.background>>
<<set $health = _charData.health>>
<<set $maxHealth = _charData.health>>
<<set $stamina = _charData.stamina>>
<<set $maxStamina = _charData.stamina>>
<<set $reputation = _charData.reputation>>
<<set $actionPoints = _charData.actionPoints>>
<<set $maxActionPoints = _charData.actionPoints>>
<<set $playerSkill = _charData.playerSkill>>
<<set $motivation = _charData.motivation>>
<<set $playerInv = _charData.playerInv>>
<<set $level = _charData.level>>
<<set $caption to true>>
<<set $tunnels to []>>
<<set $tunnels[0] to "Entrance">>
<<for _i = 1; _i <= 10; _i++>>
<<switch random(1,3)>>
<<case 1>>Trap
<<switch random(1,4)>>
<<case 1>><<set $tunnels.push("Spike")>>
<<case 2>><<set $tunnels.push("Debris")>>
<<case 3>><<set $tunnels.push("Tripwire")>>
<<case 4>><<set $tunnels.push("Rope")>>
<</switch>>
<<case 2>><<set $tunnels.push("Ambush")>>
<<case 3>><<set $tunnels.push("Safe")>>
<</switch>>
<</for>>
<<set $tunnels.push("Chamber")>>
<<set $step to 0>>
<<goto "Tunnels">>
<</link>> \
<</capture>>\
<</for>>\
<<else>>\
This master has no fighters. Play Pit Masters to add fighters to this master roost.
<</if>>
[[Back|Select Master 2]]<<set $caption to true>>\
<center><h2>Select Fighters</h2></center>
<<set $characterList = recall('characterList') ?? []>>\
<<do>>\
<<if $characterList.length > 0>>\
<<for _charData range $characterList>>\
<<capture _charData>>\
<<set _price to _charData.level * 10>>\
<<link '_charData.name (_charData.background Level _charData.level): _price gold'>>\
<<set _price to _charData.level * 10>>\
<<if $gold >= _price>>\
<<set $gold -= _price>>\
<<set $fighters.push(_charData)>>\
<<for _i, _char range $characterList>>\
<<if _char.name is _charData.name>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
<<set $characterList.deleteAt(_index)>>\
<<run memorize('characterList', $characterList)>>\
<<for _i, _char range $masterList>>\
<<if _char.name is $masterName>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
<<set $masterList[_index].fighters to $fighters>>
<<set $masterList[_index].gold to $gold>>
<<run memorize('masterList', $masterList)>>\
<<redo>>\
<<else>>\
<<run UI.alert("Not enough gold!");>>\
<</if>>\
<</link>> \
<</capture>>\
<</for>>
<<else>>\
There are no fighters available. Play Pit Fighters to create new ones or pay 5 gold to try to find new ones.
<</if>>\
<<link "Find Fighters (5 gold)">>
<<if $gold >= 5>>
<<set $gold -= 5>>
<<set _fightersFound = random(1, 5)>>
<<if $master_reputation < 0>><<set _fightersFound += $master_reputation>><</if>>
<<for _i = 0; _i < _fightersFound; _i++>>
<<set _level = random(1, $master_reputation)>>
<<if _level < 1>><<set _level to 1>><</if>>
<<rndnpc _level>>
<<set _newFighter = {
name: $npcName,
background: $npcBackground,
motivation: $npcMotivation,
health: $npcHealth,
stamina: $npcStamina,
reputation: $npcLevel,
actionPoints: $npcActionPoints,
playerSkill: $npcSkill,
playerInv: $npcInv,
level: $npcLevel,
}>>
<<set $characterList.push(_newFighter)>>
<<run memorize('characterList', $characterList)>>\
<</for>>
<<for _i, _char range $masterList>>\
<<if _char.name is $masterName>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
<<set $masterList[_index].fighters to $fighters>>
<<set $masterList[_index].gold to $gold>>
<<run memorize('masterList', $masterList)>>\
<<else>>
<<run UI.alert("Not enough gold!");>>
<</if>>
<<goto "Select Fighters">>
<</link>>
<<if $fighters.length > 0>>\
<<link "Confirm Master">>\
<<goto "Select Event">>\
<</link>> \
<</if>>\
<</do>>\
<<link "Delete Master">>\
<<set $characterList = recall('characterList') ?? []>>\
<<for _fighter range $fighters>>\
<<set $characterList.push(_fighter)>>\
<</for>>\
<<run memorize('characterList', $characterList)>>\
<<for _i, _char range $masterList>>\
<<if _char.name is $masterName>>\
<<set _index = _i>>\
<<break>>\
<</if>>\
<</for>>\
<<set $masterList.deleteAt(_index)>>\
<<run memorize('masterList', $masterList)>>\
<<goto "Select Master">>\
<</link>>
[[Back|Select Master]]<<set $caption to false>>\
<center><h2>Select Master</h2></center>
<<set $masterList = recall('masterList') ?? []>>\
<<if $masterList.length > 0>>\
<<for _masterData range $masterList>>\
<<capture _masterData>>\
<<link '_masterData.name (Gold: _masterData.gold | Rep: _masterData.reputation | Fighters: _masterData.fighters.length)'>>\
<<set $masterName = _masterData.name>>\
<<set $gold = _masterData.gold>>\
<<set $master_reputation = _masterData.reputation>>\
<<set $fighters = _masterData.fighters>>\
<<set $sel to _masterData>>\
<<goto "Select Fighters">>\
<</link>>\
<</capture>>\
<br>\
<</for>>\
<<else>>\
There are no saved masters.
<</if>>
<<link "Create Master">>\
<<set $masterLevel to random(6,12)>>
<<rndnpc $masterLevel>>
<<set $masterName = $npcName>>
<<set $gold to 50>>
<<set $master_reputation to 0>>
<<set $fighters to []>>
<<set $masterBackground to "Pit Master">>
<<set $masterHealth to $npcHealth>>
<<set $masterMaxHealth to $npcMaxHealth>>
<<set $masterStamina to $npcStamina>>
<<set $masterMaxstamina to $npcMaxStamina>>
<<set $masterActionPoints to $npcActionPoints>>
<<set $masterSkill to $npcSkill>>
<<set $masterInv to $npcInv>>
<<set $masterLevel to $npcLevel>>
<<set $masterData = {
name: $masterName,
background: $npcBackground,
motivation: $npcMotivation,
health: $npcHealth,
maxhealth: $npcMaxHealth,
stamina: $npcStamina,
maxstamina: $npcMaxStamina,
actionPoints: $npcActionPoints,
maxactionPoints: $npcMaxActionPoints,
skill: $npcSkill,
inv: $npcInv,
level: $npcLevel,
reposition: false,
gold: $gold,
reputation: $master_reputation,
fighters: $fighters
}>>
<<set $masterList.push($masterData)>>
<<run memorize('masterList', $masterList)>>
<<goto "Select Fighters">>
<</link>>
[[Back|Pit Masters]]<<set $caption to false>>\
<center><h2>Select Master</h2></center>
<<set $masterList = recall('masterList') ?? []>>\
<<if $masterList.length > 0>>\
<<for _masterData range $masterList>>\
<<capture _masterData>>\
<<link '_masterData.name (Gold: _masterData.gold | Rep: _masterData.reputation | Fighters: _masterData.fighters.length)'>>\
<<set $masterName = _masterData.name>>\
<<set $gold = _masterData.gold>>\
<<set $master_reputation = _masterData.reputation>>\
<<set $fighters = _masterData.fighters>>\
<<set $masterBackground to _masterData.background>>
<<set $masterHealth to _masterData.health>>
<<set $masterMaxHealth to _masterData.maxhealth>>
<<set $masterStamina to _masterData.stamina>>
<<set $masterMaxstamina to _masterData.maxstamina>>
<<set $masterActionPoints to _masterData.actionPoints>>
<<set $masterSkill to _masterData.skill>>
<<set $masterInv to _masterData.inv>>
<<set $masterLevel to _masterData.level>>
<<goto "Select Fighter 2">>\
<</link>> \
<</capture>>\
<</for>>\
<<else>>\
There are no saved masters. Play Pit Masters to create one.
<</if>>
[[Back|Pit Rats]]<<set $skillPoints = 2>>\
<<dropall $playerSkill>>\
<center><h2>Skills</h2></center>
Choose 2 skills:
<<for _skillName, _skillDesc range $skills>>\
<<capture _skillName _skillDesc>>\
<<link _skillName>>
<<dialog _skillName>>\
<<print _skillDesc>><br>\
<<if $skillPoints > 0>>\
<<link "Confirm">>\
<<pickup $playerSkill _skillName 1>>
<<set $skillPoints -= 1>>
<<redo>>
<<dialogclose>>
<</link>>
<</if>>\
<<link "Back">>
<<dialogclose>>
<</link>>\
<</dialog>>
<</link>> \
<</capture>>\
<</for>>
<<do>>Chosen Skills: <<for _skill, _skillLevel range $playerSkill.table>>_skill (_skillLevel) <</for>><<if $skillPoints is 0>><br>[[Confirm|Motivation]]<</if>><</do>>
<<link "Random Skills">>
<<set _newSkill to either($allSkills.list)>>
<<pickup $npcSkill _newSkill 1>>
<<set _newSkill to either($allSkills.list)>>
<<pickup $npcSkill _newSkill 1>>
<</link>> \
[[Clear|Skills]]
[[Back|Create Fighter]]<<silent>>
<<switch $fightMode>>
<<case "Duel">>
<<set $npcLevel to Math.clamp(random($master_reputation-1,$master_reputation+1), 2, 6)>>
<<rndnpc $npcLevel>>
<<case "Skirmish">>
<<set $npcLevel to Math.clamp(random($master_reputation-2,$master_reputation), 1, 3)>>
<<rndnpc $npcLevel>>
<<case "Champion">>
<<set $npcLevel to Math.clamp(random($master_reputation,$master_reputation+2), 3, 10)>>
<<rndnpc $npcLevel>>
<</switch>>
<<set $foe = {
name: $npcName,
background: $npcBackground,
level: $npcLevel
}>>
<</silent>>\
<center><h2>$fightMode</h2></center>\
<<set $mes to "Choose your fighter:">>\
<<set $reaction to "">><<set $masterReaction to "">>\
<<do>>\
<<Reaction>>
$mes
<<if $reaction isnot "">><<= $reaction>><br><</if>><<set $reaction to "">><<if $masterReaction isnot "">><<= $masterReaction>><br><</if>><<set $masterReaction to "">>\
<<if $fighters.length > 0>>\
<<for _i, _fighter range $fighters>>\
<<capture _fighter>>\
<<link '_fighter.name (_fighter.background _fighter.level)'>>\
<<set $playerFighter = _fighter>>\
<<set _playerRoll = random(0, $playerFighter.level)>>\
<<set _foeRoll = random(0, $foe.level)>>\
<<set _bonusChart = {
"Gladiator": "Brawler",
"Brawler": "Noble",
"Noble": "Mercenary",
"Mercenary": "Gladiator"
}>>\
<<if _bonusChart[$playerFighter.background] is $foe.background>>\
<<set _playerRoll += 2>>\
<<elseif _bonusChart[$foe.background] is $playerFighter.background>>\
<<set _foeRoll += 2>>\
<</if>>\
<<if _playerRoll > _foeRoll>>\
<<set $mes to $playerFighter.name + " (" + $playerFighter.background + " " + $playerFighter.level + ")" + " fights " + $npcName + " (" + $npcBackground + " " + $npcLevel + ")" + " and wins! You earn rewards.">>
<<switch $playerFighter.background>>
<<case "Gladiator">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $reaction to "'Another step toward legend!' the Gladiator boasts, basking in the cheers." >>
<<case "Wealth">>
<<set $reaction to "'Hope the purse is worth the bruises,' the Gladiator mutters, wiping off blood." >>
<<case "Revenge">>
<<set $reaction to "'One more falls. One step closer,' they whisper, eyes burning with old grudges." >>
<<case "Survival">>
<<set $reaction to "'Live today, fight tomorrow,' the Gladiator sighs, barely acknowledging the victory." >>
<</switch>>
<<case "Brawler">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $reaction to "'Who else wants some?!' the Brawler roars, high on the thrill of the fight." >>
<<case "Wealth">>
<<set $reaction to "'Drinks on me—once I get paid,' the Brawler smirks, stretching bruised knuckles." >>
<<case "Revenge">>
<<set $reaction to "'That one wasn’t even personal,' they scoff, but their fists remain clenched." >>
<<case "Survival">>
<<set $reaction to "'Good fight. Still breathing. That’s all that matters,' the Brawler mutters." >>
<</switch>>
<<case "Noble">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $reaction to "'The art of combat is alive in me,' the Noble proclaims, savoring the victory." >>
<<case "Wealth">>
<<set $reaction to "'Hopefully, the right people were watching,' they muse, adjusting their attire." >>
<<case "Revenge">>
<<set $reaction to "'Not the one I seek, but close enough for now,' they murmur, brushing off dust." >>
<<case "Survival">>
<<set $reaction to "'I was never meant for this life, yet here I am,' the Noble sighs." >>
<</switch>>
<<case "Mercenary">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $reaction to "'Another contract fulfilled. Another story for the songs,' the Mercenary grins." >>
<<case "Wealth">>
<<set $reaction to "'Gold spends the same, no matter who bleeds for it,' they remark indifferently." >>
<<case "Revenge">>
<<set $reaction to "'Every fight is practice for the one that truly matters,' they mutter." >>
<<case "Survival">>
<<set $reaction to "'Another fight, another day above ground,' the Mercenary sighs." >>
<</switch>>
<</switch>>
<<if $fightMode is "Duel">>\
<<set $gold += random(20, 30)>>\
<<set $master_reputation += 1>>\
<<elseif $fightMode is "Skirmish">>\
<<set $gold += random(30, 40)>>\
<<set $master_reputation += 0>>\
<<elseif $fightMode is "Champion">>\
<<set $gold += random(10, 20)>>\
<<set $master_reputation += 2>>\
<</if>>\
<<switch $fightMode>>
<<case "Duel">>
<<set $npcLevel to Math.clamp(random($master_reputation-1,$master_reputation+1), 2, 6)>>
<<rndnpc $npcLevel>>
<<case "Skirmish">>
<<set $npcLevel to Math.clamp(random($master_reputation-2,$master_reputation), 1, 3)>>
<<rndnpc $npcLevel>>
<<case "Champion">>
<<set $npcLevel to Math.clamp(random($master_reputation,$master_reputation+2), 3, 10)>>
<<rndnpc $npcLevel>>
<</switch>>
<<set $foe = {
name: $npcName,
background: $npcBackground,
level: $npcLevel
}>>
<<set $playerFighter.level += 1>>
<<set _upgradeList to [
"Reputation",
"Gear",
"Skill",
"Health",
"Stamina",
"Action Points"
]>>
<<if $playerFighter.motivation is "Glory">><<set $playerFighter.reputation += 1>><</if>>
<<if $playerFighter.motivation is "Wealth">><<set _upgradeList.push("Gear")>><</if>>
<<if $playerFighter.motivation is "Revenge">><<set _upgradeList.push("Stamina")>><</if>>
<<if $playerFighter.motivation is "Survival">><<set _upgradeList.push("Health")>><</if>>
<<for _level = 2; _level <= $playerFighter.level; _level++>>
<<set _upgrade to either(_upgradeList)>>
<<switch _upgrade>>
<<case "Reputation">>
$playerFighter.reputation += 1
<<case "Gear">>
<!-- Selects a weapon based on skills -->
<<if $playerFighter.playerSkill.has('Melee') and !$playerFighter.playerInv.hasAny($meleeGear.list)>>
<<set _randomItem = either($meleeGear.list)>>
<<pickup $playerFighter.playerInv _randomItem $meleeGear.count(_randomItem)>>
<<elseif $playerFighter.playerSkill.has('Archery') and !$playerFighter.playerInv.hasAny($archeryGear.list)>>
<<set _randomItem = either($archeryGear.list)>>
<<pickup $playerFighter.playerInv _randomItem $archeryGear.count(_randomItem)>>
<<elseif !$playerFighter.playerInv.hasAny($armor.list)>>
<<set _randomItem = either($armor.list)>>
<<pickup $playerFighter.playerInv _randomItem $armor.count(_randomItem)>>
<<elseif !$playerFighter.playerInv.has('Bandages')>>
<<pickup $playerFighter.playerInv "Bandages" 2>>
<<elseif !$playerFighter.playerInv.has('Strong Brew')>>
<<pickup $playerFighter.playerInv "Strong Brew" 2>>
<<elseif !$playerFighter.playerInv.has('Shield')>>
<<pickup $playerFighter.playerInv "Shield" 2>>
<<else>>
<<set $playerFighter.reputation += 1>>
<</if>>
<<case "Skill">>
<<set _newSkill to either($allSkills.list)>>
<<if $playerFighter.playerSkill.count(_newSkill) < 5>>
<<pickup $playerFighter.playerSkill _newSkill 1>>
<<else>>
<<set $playerFighter.reputation += 1>>
<</if>>
<<case "Health">>
<<set $playerFighter.health += 1>>
<<case "Stamina">>
<<set $playerFighter.stamina += 1>>
<<case "Action Points">>
<<if _level >= 4>>
<!-- Noble fighters get extra action points -->
<<if $playerFighter.background == "Noble">>
<<if _level < 7 and $playerFighter.actionPoints < 5>>
<<set $playerFighter.actionPoints += 1>>
<<elseif _level >= 7 and $playerFighter.actionPoints < 6>>
<<set $playerFighter.actionPoints += 1>>
<<else>>
<<set $playerFighter.reputation += 1>>
<</if>>
<<else>>
<<if _level < 7 and $playerFighter.actionPoints < 4>>
<<set $playerFighter.actionPoints += 1>>
<<elseif _level >= 7 and $playerFighter.actionPoints < 5>>
<<set $playerFighter.actionPoints += 1>>
<<else>>
<<set $playerFighter.reputation += 1>>
<</if>>
<</if>>
<<else>>
<<set $playerFighter.reputation += 1>>
<</if>>
<</switch>>
<</for>>
<<for _t, _char range $fighters>>\
<<if _char.name is $playerFighter.name>>\
<<set _index = _t>>\
<<break>>\
<</if>>\
<</for>>\
<<set $fighters[_index] = _fighter>>
<<else>>\
<<set $mes to $playerFighter.name + " (" + $playerFighter.background + " " + $playerFighter.level + ")" + " fights " + $npcName + " (" + $npcBackground + " " + $npcLevel + ")" + " and loses. No major rewards.">>
<<switch $playerFighter.background>>
<<case "Gladiator">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $masterReaction to "'Fool thought he was invincible. Glory means nothing in a grave.'" >>
<<case "Wealth">>
<<set $masterReaction to "'Wasted investment. I should’ve bet against him.'" >>
<<case "Revenge">>
<<set $masterReaction to "'If vengeance was worth dying for, he got what he wanted.'" >>
<<case "Survival">>
<<set $masterReaction to "'Didn’t fight hard enough. The pits don’t forgive weakness.'" >>
<</switch>>
<<case "Brawler">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $masterReaction to "'Swagger means nothing if you can’t back it up. He learned that the hard way.'" >>
<<case "Wealth">>
<<set $masterReaction to "'Should’ve fought for the money, not the thrill. Idiot.'" >>
<<case "Revenge">>
<<set $masterReaction to "'I wonder if they found peace in that last breath. I doubt it.'" >>
<<case "Survival">>
<<set $masterReaction to "'If even the tough ones fall, what chance do the rest have?'" >>
<</switch>>
<<case "Noble">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $masterReaction to "'A noble in the dirt, just like the rest. Titles mean nothing here.'" >>
<<case "Wealth">>
<<set $masterReaction to "'I wonder if their rich friends will even bother to collect the body.'" >>
<<case "Revenge">>
<<set $masterReaction to "'Tragic. Another one who thought a sword could rewrite the past.'" >>
<<case "Survival">>
<<set $masterReaction to "'So much for their highborn blood keeping them alive.'" >>
<</switch>>
<<case "Mercenary">>
<<switch $playerFighter.motivation>>
<<case "Glory">>
<<set $masterReaction to "'Another sellsword who thought they were better than the odds. They weren’t.'" >>
<<case "Wealth">>
<<set $masterReaction to "'Gold’s no good to a corpse. Maybe I can still loot their pockets.'" >>
<<case "Revenge">>
<<set $masterReaction to "'Revenge or no, the dead don’t get second chances. Pity.'" >>
<<case "Survival">>
<<set $masterReaction to "'Funny how even the professionals don’t always make it.'" >>
<</switch>>
<</switch>>
<<if $fightMode is "Duel">>\
<<set $gold += random(10, 20)>>\
<<set $master_reputation += 0>>\
<<elseif $fightMode is "Skirmish">>\
<<set $gold += random(20, 30)>>\
<<set $master_reputation -= 1>>\
<<if $master_reputation < -5>><<set $master_reputation to -5>><</if>>\
<<elseif $fightMode is "Champion">>\
<<set $gold += random(0, 10)>>\
<<set $master_reputation += 1>>\
<</if>>\
<<for _t, _char range $fighters>>\
<<if _char.name is $playerFighter.name>>\
<<set _index = _t>>\
<<break>>\
<</if>>\
<</for>>\
<<set $fighters.deleteAt(_index)>>
<</if>>\
<<for _a, _char range $masterList>>\
<<if _char.name is $masterName>>\
<<set _index = _a>>\
<<break>>\
<</if>>\
<</for>>\
<<set $masterList[_index].gold to $gold>>
<<set $masterList[_index].reputation to $master_reputation>>
<<set $masterList[_index].fighters to $fighters>>
<<run memorize('masterList', $masterList)>>
<<redo>>\
<</link>> \
<</capture>>\
<</for>>\
<<else>>\
No available fighters.
<</if>>
[[Back|Select Event]]
<<silent>>\
<<if $master_reputation >= 10 and !$achievement[2]>>
<<set $achievement[2] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''Blood and Gold''<</notify>>
<</if>>
<<if $gold >= 1000 and !$achievement[3]>>
<<set $achievement[3] to true>>
<<run memorize('achievement', $achievement)>>
<<notify 4s>>Achievement unlocked! ''Wealth of the Arena''<</notify>>
<</if>>
<</silent>>\
<</do>>\<<silent>>
<<set $close to false>><<dropall $droppedList>>
<<switch $fightMode>>
<<case "Duel">>
<<set $npcLevel to $level>>
<<rndnpc $npcLevel>>
<<case "Skirmish">>
<<set _minLevel to Math.max(1, $level - Math.floor($level / 2))>>
<<set $npcLevel to random(_minLevel, $level - 1)>>
<<if $npcLevel < 1>><<set $npcLevel to 1>><</if>>
<<rndnpc $npcLevel>>
<<case "Champion">>
<<set _maxLevel to $level + Math.floor($level / 3)>>
<<if _maxLevel < $level + 1>><<set _maxLevel to $level + 1>><</if>>
<<set $npcLevel to random($level + 1, _maxLevel)>>
<<rndnpc $npcLevel>>
<<case "Ambush">>
<<set _minLevel to Math.max(1, $level - Math.floor($level / 2))>>
<<set $npcLevel to random(_minLevel, $level)>>
<<if $npcLevel < 1>><<set $npcLevel to 1>><</if>>
<<rndnpc $npcLevel>>
<<case "Final">>
<<set $npcName to $masterName>>
<<set $npcBackground to $masterBackground>>
<<set $npcHealth to $masterHealth>>
<<set $npcMaxHealth to $masterMaxHealth>>
<<set $npcStamina to $masterMaxstamina>>
<<set $npcMaxStamina to $masterMaxstamina>>
<<set $npcMaxActionPoints to $masterActionPoints>>
<<set $npcSkill to $masterSkill>>
<<set $npcInv to $masterInv>>
<<set $npcLevel to $masterLevel>>
<</switch>>
<<set $foe = {
name: $npcName,
background: $npcBackground,
motivation: $npcMotivation,
health: $npcHealth,
maxhealth: $npcMaxHealth,
stamina: $npcStamina,
maxstamina: $npcMaxStamina,
actionPoints: $npcMaxActionPoints,
maxactionPoints: $npcMaxActionPoints,
skill: $npcSkill,
inv: $npcInv,
level: $npcLevel,
reposition: false,
}>>
<</silent>>\
<center><h2>$fightMode</h2></center>\
<<set $mes to "">>\
<<set $knockedEnemy to false>>\
<<set $knocked to false>>\
<<set $reposition to false>>\
<<do>>\
$mes
<center><<showfoe>></center>\
<<if $health > 0 and $foe.health > 0>>\
<<link 'Move'>>
<<set _staminaCost to 0>>
<<if $playerInv.hasAny("Chainmail", "Plate Armor")>>
<<set _staminaCost to 1>>
<</if>>
<<if $stamina >= _staminaCost and $actionPoints >= 1>>
<<if $close is true>>
<<set $close to false>>
<<set $mes to "You move away from your opponent.">>
<<else>>
<<set $close to true>>
<<set $mes to "You move closer to your opponent.">>
<</if>>
<<set $actionPoints -= 1>>
<<set $stamina -= _staminaCost>>
<<else>>
<<set $mes to "Not enough Stamina or Action Points to move!">>
<</if>>
<<redo>>
<</link>> \
<<link "Reposition">>
<<if $actionPoints < 1>>
<<set $mes to "Not enough Action Points!">>
<<elseif $reposition>>
<<set $mes to "You have already repositioned.">>
<<else>>
<<set $actionPoints -= 1>>
<<set $reposition = true>>
<<set $mes to "You reposition yourself carefully, gaining a skill bonus on your next attack.">>
<</if>>
<<redo>>
<</link>> \
<<link 'Attack'>>
<<if $actionPoints >= 1>>
<<ChooseWeapon>>
<<else>>
<<set $mes to "Not enough Action Points to attack!">>
<<redo>>
<</if>>
<</link>> \
<<if $droppedList.length > 0>>\
<<link 'Pick up'>>
<<dialog "Pick up">>
Pick up a weapon from the ground: 1 AP.
<<if $actionPoints >= 1>>\
<<for _item, _quantity range $droppedList.table>>\
<<if $allWeapons.has(_item)>>\
<<link _item>>
<<transfer $droppedList $playerInv _item $droppedList.count(_item)>>
<<set $actionPoints -= 1>>
<<dialogclose>>
<<redo>>
<</link>> \
<</if>>\
<</for>>
<<link "Cancel">>
<<dialogclose>>
<</link>>
<<else>>\
Not enough AP.
<<link "OK">>
<<dialogclose>>
<</link>>
<</if>>
<</dialog>>\
<</link>> \
<</if>>\
<<link "Recover">>
<<if $stamina >= $maxStamina>>
<<set $mes to "Your Stamina is already full. No need to recover.">>
<<elseif $actionPoints >= 1>>
<<set $actionPoints -= 1>>
<<set $stamina to Math.min($stamina + Math.floor($maxStamina / 2), $maxStamina)>>
<<set $mes to "You take a moment to recover, regaining some Stamina.">>
<<else>>
<<set $mes to "Not enough Action Points!">>
<</if>>
<<redo>>
<</link>> \
<<if $playerInv.has("Bandages")>>\
<<link "Treat Wounds">>
<<if $actionPoints < 1>>
<<set $mes to "Not enough Action Points!">>
<<elseif $health >= $maxHealth>>
<<set $mes to "You are not injured and don't need treatment.">>
<<else>>
<<set $actionPoints -= 1>>
<<set $health to Math.min($health + Math.floor($maxHealth / 2), $maxHealth)>>
<<drop $playerInv "Bandages" 1>>
<<set $mes to "You treat your wounds, using a bandage and recovering some Health.">>
<</if>>
<<redo>>
<</link>> \
<</if>>\
<<if $playerInv.has("Strong Brew")>>\
<<link "Drink Brew">>
<<if $actionPoints < 1>>
<<set $mes to "Not enough Action Points!">>
<<elseif $stamina >= $maxStamina>>
<<set $mes to "Your Stamina is already full. No need to drink a Strong Brew.">>
<<else>>
<<set $actionPoints -= 1>>
<<set $stamina to $maxStamina>>
<<drop $playerInv "Strong Brew" 1>>
<<set $mes to "You drink a Strong Brew, restoring all Stamina.">>
<</if>>
<<redo>>
<</link>> \
<</if>>\
<<link "Next Turn">>
<<EnemyTurn>>
<</link>>
<<else>>\
<<link "End Combat">>
<<if $health > 0>>
<<if $fightMode is "Ambush">>
<<goto "Loot">>
<<elseif $fightMode is "Final">>
<<goto "Ending 2">>
<<else>>
<<goto "Level up">>
<</if>>
<<else>>\
<<set $deathdate to new Date().toLocaleString()>>
<<set $characterData = {
name: $fighterName,
background: $background,
health: $maxHealth,
stamina: $maxStamina,
reputation: $reputation,
actionPoints: $maxActionPoints,
playerSkill: $playerSkill,
motivation: $motivation,
playerInv: $playerInv,
level: $level,
death: $deathdate
}>>
<<set $cemeteryList = recall('cemeteryList') ?? []>>
<<set $cemeteryList.push($characterData)>>
<<run memorize('cemeteryList', $cemeteryList)>>
<<for _i, _char range $characterList>>
<<if _char.name is $fighterName>>
<<set _index = _i>>
<<break>>
<</if>>
<</for>>
<<set $characterList.deleteAt(_index)>>
<<run memorize('characterList', $characterList)>>
<<if $game is "Pit Rats">>
<<for _t, _char range $fighters>>\
<<if _char.name is $fighterName>>\
<<set _index = _t>>\
<<break>>\
<</if>>\
<</for>>\
<<set $fighters.deleteAt(_index)>>
<<for _a, _char range $masterList>>\
<<if _char.name is $masterName>>\
<<set _index = _a>>\
<<break>>\
<</if>>\
<</for>>\
<<set $masterList[_index].stamina to $masterMaxStamina>>
<<set $masterList[_index].fighters to $fighters>>
<<run memorize('masterList', $masterList)>>\
<</if>>
<<goto "Cemetery">>
<</if>>
<</link>>
<</if>>
<</do>>\<<do>>\
<<if $caption>>\
<<switch $game>>\
<<case "Pit Fighters">>\
''$fighterName'' ($background $level)
Motivation: $motivation
Reputation: $reputation
<center>\
<table>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:red;@@</center>\
<span class="tooltiptext">Health</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'healthBar' `$health / $maxHealth`>>\
<span class="tooltiptext">Health</span>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:yellow;@@</center>\
<span class="tooltiptext">Stamina</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'staminaBar' `$stamina / $maxStamina`>>\
<span class="tooltiptext">Stamina</span>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:lightblue;@@</center>\
<span class="tooltiptext">Action points</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'apBar' `$actionPoints / $maxActionPoints`>>\
<span class="tooltiptext">Action points</span>\
</div>\
</td>\
</tr>\
</table>\
</center>\
Skills: <<set _count = 0>><<for _item, _quantity range $playerSkill.table>>\
<<print _item + " " + _quantity>><<set _count += 1>><<if _count < $playerSkill.uniqueLength>>, <</if>><</for>>
Gear: <<set _count = 0>><<for _item, _quantity range $playerInv.table>>\
<<print _item + "(" + _quantity+ ")">><<set _count += 1>><<if _count < $playerInv.uniqueLength>>, <</if>><</for>>
<<case "Pit Masters">>\
''$masterName''
Gold: $gold
Reputation: $master_reputation
Fighters:
<<for _charData range $fighters>>\
<<set $characterData = { name: _charData.name, background: _charData.background, health: _charData.health, stamina: _charData.stamina, reputation: _charData.reputation, actionPoints: _charData.actionPoints, playerSkill: _charData.playerSkill, motivation: _charData.motivation, playerInv: _charData.playerInv, level: _charData.level }>>\
<<= '_charData.background _charData.level'>><br>
<</for>>\
<<case "Pit Rats">>\
''$fighterName'' ($background $level)
Motivation: $motivation
Reputation: $reputation
<center>\
<table>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:red;@@</center>\
<span class="tooltiptext">Health</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'healthBar' `$health / $maxHealth`>>\
<span class="tooltiptext">Health</span>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:yellow;@@</center>\
<span class="tooltiptext">Stamina</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'staminaBar' `$stamina / $maxStamina`>>\
<span class="tooltiptext">Stamina</span>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="tooltip">\
<center>@@.icon;color:lightblue;@@</center>\
<span class="tooltiptext">Action points</span>\
</div>\
</td>\
<td>\
<div class="tooltip">\
<<showmeter 'apBar' `$actionPoints / $maxActionPoints`>>\
<span class="tooltiptext">Action points</span>\
</div>\
</td>\
</tr>\
</table>\
</center>\
Skills: <<set _count = 0>><<for _item, _quantity range $playerSkill.table>>\
<<print _item + " " + _quantity>><<set _count += 1>><<if _count < $playerSkill.uniqueLength>>, <</if>><</for>>
Gear: <<set _count = 0>><<for _item, _quantity range $playerInv.table>>\
<<print _item + "(" + _quantity+ ")">><<set _count += 1>><<if _count < $playerInv.uniqueLength>>, <</if>><</for>>
<</switch>>\
<</if>>\
<</do>>\<<newinv $playerInv>>
<<newinv $playerSkill>>
<<newinv $npcInv>>
<<newinv $npcSkill>>
<<newinv $droppedList>>
<<set $items = {
"Sword": {desc: "A well-balanced blade that delivers powerful melee strikes.", durability: 4},
"Mace": {desc: "A heavy weapon that deals blunt force trauma, wearing down stamina.", durability: 6},
"Spear": {desc: "A versatile polearm effective in both melee and ranged attacks, though it requires extra stamina to wield.", durability: 2},
"Bow": {desc: "A ranged weapon with modest damage that allows attacks from a distance but takes longer to prepare.", durability: 6},
"Crossbow": {desc: "A powerful ranged weapon that deals devastating damage but requires significant time to reload.", durability: 4},
"Leather Armor": {desc: "Lightweight protection that absorbs some damage while allowing mobility.", durability: 4},
"Chainmail": {desc: "Sturdy armor that absorbs considerable damage but demands extra stamina for movement and dodging.", durability: 6},
"Plate Armor": {desc: "Heavy armor that provides superior protection but hinders movement and makes dodging impossible.", durability: 8},
"Bandages": {desc: "A simple medical supply that helps recover from wounds and keep fighting.", durability: 2},
"Strong Brew": {desc: "A revitalizing drink that restores all stamina and helps endure prolonged battles.", durability: 2},
"Shield": {desc: "A defensive tool that allows blocking incoming attacks and adds extra resilience in combat.", durability: 2}
}>>
<<set $skills = {
"Melee": "Skill in close-quarters combat using melee weapons.",
"Unarmed": "Skill in close-quarters combat using bare hands and knock attacks.",
"Versatile": "Skill used to dodge, throw weapons, and disarm opponents.",
"Archery": "Skill in ranged combat with bows and crossbows."
}>>
<<newinv $allSkills>>
<<pickup $allSkills "Melee" 1 "Unarmed" 1 "Versatile" 1 "Archery" 1>>
<<newinv $allGear>>
<<pickup $allGear "Sword" 4 "Mace" 6 "Spear" 2 "Bow" 6 "Crossbow" 4 "Leather Armor" 4 "Chainmail" 6 "Plate Armor" 8 "Bandages" 2 "Strong Brew" 2 "Shield" 2>>
<<newinv $meleeGear>>
<<pickup $meleeGear "Sword" 4 "Mace" 6 "Spear" 2>>
<<newinv $archeryGear>>
<<pickup $archeryGear "Bow" 6 "Crossbow" 4>>
<<newinv $allWeapons>>
<<pickup $allWeapons "Sword" 4 "Mace" 6 "Spear" 2 "Bow" 6 "Crossbow" 4>>
<<newinv $brawlerGear>>
<<pickup $brawlerGear "Leather Armor" 4 "Chainmail" 6 "Plate Armor" 8 "Bandages" 2 "Strong Brew" 2 "Shield" 2>>
<<newinv $versatileGear>>
<<pickup $versatileGear "Bandages" 2 "Strong Brew" 2 "Shield" 2>>
<<newinv $unarmedGear>>
<<pickup $unarmedGear "Leather Armor" 4 "Chainmail" 6 "Plate Armor" 8>>
<<newinv $secondGear>>
<<pickup $secondGear "Leather Armor" 4 "Chainmail" 6 "Plate Armor" 8 "Bandages" 2 "Strong Brew" 2 "Shield" 2>>
<<newinv $armor>>
<<pickup $armor "Leather Armor" 4 "Chainmail" 6 "Plate Armor" 8>>
<<newinv $itens>>
<<pickup $itens "Bandages" 2 "Strong Brew" 2 "Shield" 2>>
<<set $game = "">>
<<set $characterList to []>>
<<set $cemeteryList to []>>
<<set $masterList to []>>
<<set $fighters to []>>
<<set $achievement to []>>
<<set $achievement = recall('achievement') ?? []>>
// Health meter
<<newmeter 'healthBar'>><<label '$health / $maxHealth'>>
<<colors '#6b8e23' '#8b4513'>>
<</newmeter>>
<<newmeter 'foeBar'>><<label '$foe.health / $foe.maxhealth'>>
<<colors '#6b8e23' '#8b4513'>>
<</newmeter>>
// Stamina meter */
<<newmeter 'staminaBar'>><<label '$stamina / $maxStamina'>>
<<colors '#c0a16b' '#b5651d'>>
<</newmeter>>
// Action points meter */
<<newmeter 'apBar'>><<label '$actionPoints / $maxActionPoints'>>
<<colors '#87ceeb' '#4682b4'>>
<</newmeter>>
<<set $firstNames = [
"Ragnar", "Thorn", "Kael", "Gorath", "Elyan", "Durgan", "Thalric", "Lucan", "Rhaegar", "Baldric",
"Kharon", "Gareth", "Leofric", "Ulric", "Bran", "Dain", "Hakon", "Jorunn", "Merric", "Orin",
"Perrin", "Roderic", "Torvald", "Wulfric", "Zarek", "Cedric", "Godric", "Draven", "Rowan", "Edric",
"Torrhen", "Alaric", "Fenrir", "Tyrion", "Eirik", "Kaelar", "Dorian", "Eldric", "Bjorn", "Aric",
"Galen", "Corwin", "Hadrian", "Tormund", "Zephyr", "Halvar", "Alden", "Roderick", "Theron", "Magnus",
"Leoric", "Tavish", "Solomon", "Cassian", "Varian", "Tybalt", "Iskander", "Soren", "Drystan", "Viktor",
"Maric", "Lorien", "Brom", "Caius", "Dain", "Valen", "Orryn", "Tristan", "Lysander", "Eamon",
"Havard", "Ragnarok", "Faelan", "Malrik", "Fenris", "Destrian", "Arvid", "Eryk", "Garrick", "Ronan",
"Talon", "Xandor", "Edrik", "Ignatius", "Severin", "Veylan", "Belric", "Kaedon", "Siegfried", "Mordecai",
"Rhaelor", "Thalion", "Caspian", "Zephyrus", "Orpheus", "Tarek", "Malachai", "Vorn", "Aetheron", "Dragan",
"Sirona", "Valeria", "Morwen", "Nyssa", "Vorna", "Talia", "Isolde", "Freya", "Morgana", "Ygritte",
"Cassia", "Elara", "Lyra", "Seraphina", "Vigdis", "Xandra", "Eowyn", "Sigrid", "Sylvaine", "Maeve",
"Anwyn", "Brienne", "Sable", "Selene", "Lilith", "Naeris", "Vespera", "Sybil", "Astrid", "Evadne",
"Zaira", "Elysia", "Callista", "Ysara", "Vanya", "Nerys", "Rhiannon", "Eleanor", "Verena", "Giselle",
"Ophelia", "Aisling", "Rowena", "Isolde", "Fiora", "Tamsin", "Celestia", "Dahlia", "Mirabel", "Evelyne",
"Calista", "Amara", "Zelene", "Ylva", "Selina", "Vivienne", "Rosalind", "Thessaly", "Elowen", "Saphira",
"Eirwen", "Melisande", "Aradia", "Nova", "Ismira", "Odessa", "Theora", "Lirael", "Sarai", "Zorya",
"Mirelle", "Ilyana", "Seren", "Nimue", "Auriel", "Selka", "Tindra", "Nyx", "Ariadne", "Sione",
"Zephyra", "Evania", "Lilwen", "Noctra", "Vaelora", "Isolwyn", "Desdemona", "Thalassa", "Yseult", "Aelith",
"Ravenna", "Morrigan", "Lunara", "Vailya", "Orlaith", "Lucienne", "Elspeth", "Myrrha", "Anara", "Faelith"
]>>
<<set $lastNames = [
"Blacktooth", "Bloodblade", "Ironfist", "Stonebreaker", "Grimshade", "the Brutal", "Swiftblade", "Nightstalker", "Bonecrusher", "Shadowstep",
"Firebrand", "Ironclad", "the Relentless", "Stormfury", "the Silent", "Stormrider", "Darkbane", "Steelheart", "Frostwolf", "Ashenvein",
"Windrider", "Ironhelm", "Thundershield", "Ravenwood", "Brightspear", "Stormcloak", "Bloodstone", "Nightfall", "Hawkeye", "Blazewind",
"Shadowthorn", "Skullcrusher", "Ironhand", "Wolfsbane", "Bloodmoon", "Ironfang", "Frostclaw", "Darkblade", "Starfall", "Stormborn",
"Ravenshadow", "Dawnbringer", "Moonshadow", "Frostblade", "Emberheart", "Shadowflame", "Thunderstrike", "Dreadforge", "Nightshade", "Stormchaser",
"Ironvein", "Bloodthorn", "Frostfang", "Shadowveil", "Stormforge", "Darkthorn", "Ravenclaw", "Emberstrike", "Frostvein", "Nightveil",
"Thunderclap", "Dreadblade", "Shadowforge", "Stormveil", "Nightforge", "Ironthorn", "Bloodveil", "Frostclaw", "Shadowstrike", "Stormthorn",
"Darkforge", "Ravenstrike", "Emberclaw", "Froststrike", "Nightclaw", "Thunderforge", "Dreadthorn", "Shadowclaw", "Stormstrike", "Ironstrike",
"Bloodclaw", "Frostforge", "Shadowthorn", "Stormclaw", "Darkstrike", "Ravenforge", "Emberthorn", "Frostthorn", "Nightstrike", "Thunderclaw",
"Dreadstrike", "Ironclaw", "Bloodstrike", "Froststrike", "Darkclaw", "Blackhowl", "Redfury", "Fangborne", "Nightshackle", "Ashclaw", "Grimveil",
"Bloodbane", "Dreadmaw", "Blackthorn", "Vileborn", "Ashenclaw", "Grimshackle", "Goretide", "Bonegrinder", "Stormchain",
"Warhowl", "Duskrend", "Hellsong", "Ironbrand", "Wraithcaller", "Cruorhand", "Voidfang", "Daggerholt", "Rusthelm", "Ravenspike",
"Thornveil", "Frostmourn", "Nightscar", "Shadowbrand", "Hollowborn", "Morgrim", "Fleshcrown", "Emberfall", "Venomblood",
"Wraithbane", "Blightwhisper", "Redmaw", "Stormrider", "Steelbane", "Gravehowl", "Hellbraid", "Duskscourge", "Chainbreaker",
"Ashenveil", "Goldgrasp", "Blackwhisper", "Doomspire", "Gorefiend", "Thornbane", "Shadeborn", "Pyrestone", "Ironcage",
"Daggerhall", "Firevein", "Stormreaver", "Shadewind", "Cindermaw", "Bonecaster", "Riftbrand", "Warlocke", "Gallowsmith",
"Diremaw", "Nightmaul", "Hollowspire", "Ruinspire", "Blackbriar", "Deadeye", "Redcrown", "Wraithvein", "Ghostfang",
"Flintlocke", "Warborne", "Duskreaver", "Gravemaul", "Ironshade", "Grimhand", "Havocrend", "Scarborn", "Fellbrand",
"Doomhowl", "Ravenshroud", "Shadowgrasp", "Steelhand", "Onyxhelm", "Cinderfury", "Voidstalker", "Embergrasp",
"Bloodreign", "Skullrend", "Hollowspire", "Dreadchain", "Stormveil", "Dustborn", "Pyrescourge", "Bramblefist"
]>>
<<if $game is "Medieval Pits">><<else>><h3>$game</h3><</if>>\<<set $characterData = { name: $sel.name, background: $sel.background, health: $sel.health, stamina: $sel.stamina, reputation: $sel.reputation, actionPoints: $sel.actionPoints, playerSkill: $sel.playerSkill, motivation: $sel.motivation, playerInv: $sel.playerInv, level: $sel.level, death: $sel.death }>>\
<center><h2>$characterData.name</h2></center>
Background: ''$characterData.background''
Level: ''$characterData.level''
Motivation: ''$characterData.motivation''
Health: ''$characterData.health''
Stamina: ''$characterData.stamina''
Reputation: ''$characterData.reputation''
Action Points: ''$characterData.actionPoints''
Skills: ''<<set _count = 0>><<for _item, _quantity range $characterData.playerSkill.table>>\
<<print _item + " " + _quantity>><<set _count += 1>><<if _count < $characterData.playerSkill.uniqueLength>>, <</if>><</for>>''
Gear: ''<<set _count = 0>><<for _item, _quantity range $characterData.playerInv.table>>\
<<print _item + "(" + _quantity+ ")">><<set _count += 1>><<if _count < $characterData.playerInv.uniqueLength>>, <</if>><</for>>''
Death: $characterData.death
[[Back|Cemetery]]<center><h2>Tunnels</h2></center>
<<set $combat to false>>\
<<set $npc to false>>\
<<set $final to false>>\
<<set $encounters to []>>\
<<do>>\
<<silent>>\
<<switch $tunnels[$step]>>
<<case "Entrance">>
<<set $mes to "You step into the dark, musty tunnels beneath the city. The air is thick with the scent of damp stone and decay. Faint echoes of distant movement hint at unseen dangers lurking ahead. There is no turning back now.">>
<<case "Spike">>
<<set $mes to "The ground beneath your feet shifts ever so slightly. Before you can react, iron spikes shoot up from concealed holes in the floor, gleaming with dried blood from past victims. ">>
<<set $skillTest = $playerSkill.count('Versatile')>>
<<roll $skillTest>>
<<if Math.random() > $chance>>
<<set $mes += "The spikes pierce through your defenses, cutting deep into your flesh. You grit your teeth as pain shoots through your body.">>
<<set $health -= 1>><<run UI.update()>>
<<else>>
<<set $mes += "You leap backward just in time, narrowly avoiding the deadly spikes as they retract into the ground with a mechanical hiss.">>
<</if>>
<<case "Debris">>
<<set $mes to "A deep rumble echoes through the tunnel as the ceiling cracks. Loose stones and heavy chunks of rock begin crashing down around you. ">>
<<set $skillTest = $playerSkill.count('Melee')>>
<<roll $skillTest>>
<<if Math.random() > $chance>>
<<set $mes += "You fail to react in time, and a jagged rock slams into your shoulder, sending you sprawling to the ground.">>
<<set $health -= 1>><<run UI.update()>>
<<else>>
<<set $mes += "With sheer force, you raise your weapon and bash aside a falling chunk of stone, clearing a safe path before the ceiling settles again.">>
<</if>>
<<case "Tripwire">>
<<set $mes to "A faint glimmer catches your eye: a near-invisible wire stretched across the corridor. On the wall, a loaded crossbow sits in a crude mechanism, ready to fire at the slightest disturbance. ">>
<<set $skillTest = $playerSkill.count('Archery')>>
<<roll $skillTest>>
<<if Math.random() > $chance>>
<<set $mes += "A sharp twang cuts through the silence as the crossbow fires. The bolt finds its mark, burying itself painfully into your side.">>
<<set $health -= 1>><<run UI.update()>>
<<else>>
<<set $mes += "With a precise flick of your fingers, you sever the tripwire at a safe angle, preventing the crossbow from triggering.">>
<</if>>
<<case "Rope">>
<<set $mes to "A sudden pull tightens around your neck: a rope snare hidden in the darkness! As it jerks upward, your feet leave the ground, suspending you in the air. ">>
<<set $skillTest = $playerSkill.count('Unarmed')>>
<<roll $skillTest>>
<<if Math.random() > $chance>>
<<set $mes += "You claw at the noose, but the rope tightens mercilessly. The lack of air burns your lungs before you manage to tear free, gasping for breath.">>
<<set $health -= 1>><<run UI.update()>>
<<else>>
<<set $mes += "With practiced skill, you twist your body midair and grip the rope, using your own weight to loosen the snare before dropping safely to the ground.">>
<</if>>
<<case "Ambush">>
<<switch random(1 , 4)>>
<<case 1>><<set $mes to "The flickering torchlight reveals shifting shadows ahead. Before you can react, a thug lunges from the darkness, weapon drawn and eyes filled with desperation. ">>
<<case 2>><<set $mes to "A sudden noise, too late to react. From the gloom, a figure charges, blade glinting in the dim light. Their breath is ragged, their intent clear: blood must be spilled. ">>
<<case 3>><<set $mes to "The air grows heavy, instinct screams danger. A shadow detaches from the tunnel wall, rushing toward you with a desperate, wild swing. ">>
<<case 4>><<set $mes to "A whisper of movement behind you. You turn just in time to see a thug emerge from the dark, weapon raised, ready to strike. ">>
<</switch>>
<<set $combat to true>>
<<case "Safe">>
<<switch random(1 , 4)>>
<<case 1>><<set $mes to "A respite in these forsaken tunnels: a small alcove where the air is cleaner, and the walls are lined with crude bedding and scattered supplies. ">>
<<case 2>><<set $mes to "The tunnels grant you a rare kindness: a quiet recess where the air is still, the stones dry, and a few abandoned rags suggest others once found shelter here. ">>
<<case 3>><<set $mes to "A stroke of luck: a forgotten side chamber, untouched and silent. You take a moment to breathe, the distant echoes of danger fading, if only for now. ">>
<<case 4>><<set $mes to "A shallow niche in the tunnel offers a brief refuge. The flickering light reveals scattered belongings, proof that even here, someone sought safety before you. ">>
<</switch>>
<<if $health < $maxHealth>>
<<set $health += 1>><<set $mes += "You restore some of your health. ">><<run UI.update()>>
<</if>>
<<if $stamina < $maxStamina>>
<<set $stamina to $maxStamina>><<set $mes += "You restore all your stamina. ">><<run UI.update()>>
<</if>>
<<set _encounter = null>>
<<for _fighter range $fighters>>
<<if _fighter.name isnot $fighterName and not $encounters.includes(_fighter.name)>>
<<set _encounter = _fighter>>
<<break>>
<</if>>
<</for>>
<<if _encounter isnot null>>
<<set $mes += _encounter.name + " is here. ">>
<<set $npc = true>>
<<set $encounters.push(_encounter.name)>>
<</if>>
<<case "Chamber">>
<<set $mes to "The passage opens into a vast chamber, lit by flickering torches. At its center, <<=$masterName>> sits upon a crude throne of bone and iron. The Pit Master smirks, as if already knowing the outcome of this encounter. ">>
<<set $final = true>>
<</switch>>
<</silent>>\
$mes
<<if $health > 0 and !$combat and !$npc and !$final>>\
<<link "Advance">>\
<<set $step +=1>>
<<redo>>
<</link>> \
<<elseif $health > 0 and $combat>>\
<<link "Fight">><<set $fightMode to "Ambush">><<goto "StartFight">><</link>>
<<elseif $health > 0 and $npc>>\
<<set $test to $reputation - _encounter.reputation>>\
<<roll $test>>\
<<if Math.random() <= $chance>>\
<<switch _encounter.background>>\
<<case "Noble">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "A true leader rises above the rest. You have proven yourself worthy."
<<case "Wealth">>_encounter.name says: "Gold flows to those who command respect. You are among them."
<<case "Revenge">>_encounter.name says: "Justice is best served by the noble and the strong. You do not disappoint."
<<case "Survival">>_encounter.name says: "Even nobility must endure hardships. You have shown resilience."
<</switch>>\
<<case "Brawler">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "A real fighter earns their name with their fists. You’ve earned yours."
<<case "Wealth">>_encounter.name says: "A strong arm brings fortune. You’re proof of that."
<<case "Revenge">>_encounter.name says: "You fight with fire in your heart. I respect that."
<<case "Survival">>_encounter.name says: "Only the toughest make it. You’re one of them."
<</switch>>\
<<case "Gladiator">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "The arena knows your name, and now so do I."
<<case "Wealth">>_encounter.name says: "Victory fills your purse. Keep winning and you’ll never be poor."
<<case "Revenge">>_encounter.name says: "You fight like someone with unfinished business. I like that."
<<case "Survival">>_encounter.name says: "Every fight is a battle for life. You’ve proven you belong."
<</switch>>\
<<case "Mercenary">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "Another contract, another victory. You have skill."
<<case "Wealth">>_encounter.name says: "War pays well, and you seem to know your worth."
<<case "Revenge">>_encounter.name says: "Vengeance is a job like any other. You do it well."
<<case "Survival">>_encounter.name says: "A blade in hand and a coin in pocket. That’s the way to live."
<</switch>>\
<</switch>>\
<<set _offer = null>>\
<<for _item range _encounter.playerInv.list>>\
<<if !$playerInv.has(_item) and !$armor.has(_item)>>\
<<set _offer = _item>>\
<<break>>\
<</if>>\
<</for>>\
<<if _offer>>\
_encounter.name offers you their _offer.
<<link "Accept and continue">>\
<<transfer _encounter.playerInv $playerInv _offer _encounter.playerInv.count(_offer)>>
<<set $step +=1>>
<<set $npc to false>>
<<redo>>
<</link>> \
<<link "Deny and continue">>\
<<set $step +=1>>
<<set $npc to false>>
<<redo>>
<</link>> \
<<else>>\
<<link "Advance">>\
<<set $step +=1>>
<<set $npc to false>>
<<redo>>
<</link>> \
<</if>>\
<<else>>\
<<switch _encounter.background>>\
<<case "Noble">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "Glory is for those who deserve it. You are not among them."
<<case "Wealth">>_encounter.name says: "Fortune favors the bold, not the beggars."
<<case "Revenge">>_encounter.name says: "Justice is earned, not handed out. You’ll find no aid here."
<<case "Survival">>_encounter.name says: "Even the lowliest noble must stand on their own. So should you."
<</switch>>\
<<case "Brawler">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "You want a name for yourself? Earn it, like the rest of us."
<<case "Wealth">>_encounter.name says: "If you're not strong enough to take it, you don’t deserve it."
<<case "Revenge">>_encounter.name says: "I don’t fight other people’s battles. Handle your own."
<<case "Survival">>_encounter.name says: "If you can’t survive on your own, you won’t survive at all."
<</switch>>\
<<case "Gladiator">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "The arena only remembers the strong. You won't be remembered."
<<case "Wealth">>_encounter.name says: "Victory is the only currency that matters. You don’t have enough."
<<case "Revenge">>_encounter.name says: "If you want blood, spill it yourself."
<<case "Survival">>_encounter.name says: "Every fight is for survival. If you need help, you’ve already lost."
<</switch>>\
<<case "Mercenary">>\
<<switch _encounter.motivation>>\
<<case "Glory">>_encounter.name says: "Reputation is earned through action, not through favors."
<<case "Wealth">>_encounter.name says: "I don’t work for free. And I doubt you can afford me."
<<case "Revenge">>_encounter.name says: "Personal grudges don’t pay. Handle yours alone."
<<case "Survival">>_encounter.name says: "You’re either useful or you’re dead weight. Guess which one you are."
<</switch>>\
<</switch>>\
<<link "Advance">>\
<<set $step +=1>>
<<set $npc to false>>
<<redo>>
<</link>> \
<</if>>\
<<elseif $health > 0 and $final>>\
<<if $reputation >= $master_reputation>>\
<<switch $background>>\
<<case "Noble">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "A noble who truly understands battle. You didn’t buy your reputation: you bled for it. I respect that. Now, you stand at a crossroads: take my ring, rule the pit as a master of warriors, or step into the sand with me. Either way, you leave a legend."
<<case "Wealth">>$masterName says: "You came from privilege, but you earned your fortune in blood. I can’t deny your cunning. So here’s my offer: take my pit, make it the empire you’ve built with your own hands. Or fight me, and prove that even kings must bow to the strong."
<<case "Revenge">>$masterName says: "Few nobles truly understand vengeance, but you… you have become its master. I will not stand in your way. Take my ring, rule as you see fit, or fight me, and let your final act of retribution be written in blood."
<<case "Survival">>$masterName says: "You were born into luxury, but you clawed your way to where you are now. That takes more than luck: that takes will. The pit is yours if you want it. Or, if you still have something left to prove, face me in the sand and claim your ultimate victory."
<</switch>>\
<<case "Brawler">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "From the streets to the top. You’ve fought harder than anyone, and now you stand above even me. That kind of grit deserves respect. Take my pit, rule it, shape it in your image. Or fight me, and make this your final, greatest battle."
<<case "Wealth">>$masterName says: "You didn’t just fight for survival: you fought to thrive. You built your wealth with blood and sweat, and now you have a choice: take my pit and turn it into your own empire, or fight me, and prove that your fists hold more value than gold."
<<case "Revenge">>$masterName says: "You made every strike count, every wound a lesson. And now, you’ve made it here. I will not deny you your victory. Rule the pit, shape it to your will. Or step into the ring, and let’s end this the only way warriors like us understand."
<<case "Survival">>$masterName says: "I see it in your eyes: you've fought because you had to, because the world never gave you a choice. But now you have one. Take my pit and never fight for another man again. Or face me, and show the world how the strongest survive."
<</switch>>\
<<case "Gladiator">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "You were born for the arena, and now the crowd calls your name louder than mine. You’ve earned this moment. Take my pit, make it your grand stage, or fight me, and carve your name into legend with one final duel."
<<case "Wealth">>$masterName says: "Most gladiators fight for survival: you fought for power. And now, you’ve won it. Rule the pit, make the gold flow as you see fit. Or, if you truly wish to settle this, face me in the sand and claim your final prize."
<<case "Revenge">>$masterName says: "The arena is where debts are paid, and you’ve collected more than anyone. You’ve proven yourself. The pit is yours if you want it. Or, if you still crave one last reckoning, fight me, and let fate decide."
<<case "Survival">>$masterName says: "You fought because you had no choice. Now, you do. Take my pit and become the master instead of the pawn, or fight me, and prove that you never needed a master at all."
<</switch>>\
<<case "Mercenary">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "A sellsword who became a legend. I didn’t think it possible, but here you are. The pit is yours if you want it: no more contracts, no more masters. Or, if you still hunger for battle, fight me, and let’s see whose story will be told for generations."
<<case "Wealth">>$masterName says: "You fought for gold, and you turned it into power. I respect that. Take my pit, rule it as you see fit. Or face me, and let’s see if your sword is worth more than the empire you could build."
<<case "Revenge">>$masterName says: "A mercenary fueled by vengeance: it brought you here, above even me. I won’t stand in your way. Rule the pit, take control of the violence instead of feeding it. Or fight me, and make this your final act of retribution."
<<case "Survival">>$masterName says: "A mercenary fights for the next job, the next meal. But you? You’ve become something more. The pit is yours if you wish it. Or, if you still feel the need to fight, face me, and let’s see if survival is truly what drives you."
<</switch>>\
<</switch>>\
<<else>>\
<<switch $background>>\
<<case "Noble">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "A noble playing at being a warrior? You think glory is won in the dirt? You wouldn’t last a day without your title to shield you. But I’ll give you a chance: own your own ring, fill it with fighters, pretend you’ve earned their respect. Or, if you really believe in your honor, face me in the pit. I’ll carve your legacy into the sand."
<<case "Wealth">>$masterName says: "So you traded silks for steel, hoping to buy respect with blood? Pathetic. Real wealth is not inherited, it is taken. Here’s your choice: build your own ring, take from the weak, and finally understand power. Or try to fight me, and learn what happens to those who think money makes them strong."
<<case "Revenge">>$masterName says: "Nobles always think they’re owed justice, as if the world bends to their tantrums. I have another lesson for you: revenge is just another word for weakness. So, take my offer: build your own pit, let others spill blood for your cause. Or face me, and let your righteous fury die with you."
<<case "Survival">>$masterName says: "A noble talking about survival? Hah! You were born into comfort. You don't understand hunger, real hunger. But I can show you. Own your own ring, learn what it means to make others fight for your survival. Or step into the pit, and I’ll show you how fast the soft get swallowed whole."
<</switch>>\
<<case "Brawler">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "You’re just another street dog looking for a name. But names don’t matter when your body is left in the sand. Here’s your choice: own your own pit, fill it with fools like you, and pretend you made it. Or fight me, and let’s see if your fists can write your name in history."
<<case "Wealth">>$masterName says: "So you think fighting will make you rich? I’ve seen a thousand like you, bleeding out for a handful of coins. Here’s a real offer: own your own pit, take the bets, control the bloodshed. Or fight me, and lose everything."
<<case "Revenge">>$masterName says: "You hit hard, but you don’t hit smart. Revenge? That’s just fighting with your eyes closed. But if you really want power, take my deal: own your own ring, set the rules, decide who suffers. Or step into the pit, and I’ll show you how little your rage matters."
<<case "Survival">>$masterName says: "You fight because you have to. I fight because I love it. That’s the difference. But I’ll give you a choice: run your own pit, let others fight for you, finally be more than just a desperate animal. Or step in here with me, and see just how much you really want to live."
<</switch>>\
<<case "Gladiator">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "A show fighter dreaming of true glory? You dance for the crowd, but real warriors don’t need an audience. Own your own pit, let others be the entertainment. Or fight me, and I’ll make sure your last performance is unforgettable."
<<case "Wealth">>$masterName says: "Gladiators fight for coin, but the smart ones take the coin and leave the fight behind. So what’s it going to be? Own your own pit, stack the odds in your favor. Or fight me, and prove you’re just another body waiting to be buried."
<<case "Revenge">>$masterName says: "You think the arena will give you justice? It only gives death. If you want real power, take my offer: run your own pit, make others fight your battles. Or step into the pit and die for your foolish honor."
<<case "Survival">>$masterName says: "Gladiators fight to survive, but I fight because I enjoy it. That’s why you’ll lose. Take my offer: control your own ring, be the master instead of the pawn. Or fight me, and become just another forgotten corpse in the arena."
<</switch>>\
<<case "Mercenary">>\
<<switch $motivation>>\
<<case "Glory">>$masterName says: "A sellsword looking for fame? Hah! You fight for coin, not for honor. But I’ll give you a way out: own your own pit, make warriors dance for your profit. Or face me, and let’s see if your blade is worth remembering."
<<case "Wealth">>$masterName says: "A mercenary with ambition, I almost respect that. But fighting is just a job to you, and jobs don’t make kings. Own your own pit, control the money, and stop being just another blade for hire. Or fight me, and I’ll show you what happens to tools that outlive their use."
<<case "Revenge">>$masterName says: "Mercenaries don’t have grudges, they have contracts. If revenge is your payment, you’re a fool. But I’ll make you rich instead: run your own pit, take what you want. Or step into the pit, and let me collect your last debt."
<<case "Survival">>$masterName says: "A mercenary lives by the job, dies by the job. But I offer you a way out: own your own pit, call the shots, stop risking your own skin. Or fight me, and become another forgotten blade in the dirt."
<</switch>>\
<</switch>>\
<</if>>\
<<link "Accept">><<goto "Ending 1">><</link>>
<<link "Fight">><<set $fightMode to "Final">><<goto "StartFight">><</link>>
<<else>>\
<<link "End story">><<goto "Pit Rats">><</link>>
<</if>>\
<</do>>\<center><h2>Guide</h2></center>
''How to Play Medieval Pits''
Introduction
Medieval Pits is a collection of three short text-based games set in a brutal, low-fantasy medieval world. Each game mode explores a different aspect of life within the underground fighting pits. Choose your path: fight for survival, manage your own pit, or navigate the treacherous tunnels in search of revenge.
Game Modes
1. Pit Fighters – Tactical Combat
Step into the arena and fight for your life!
- Choose your fighter's background (Gladiator, Brawler, Noble, or Mercenary), motivation (Glory, Wealth, Revenge, or Survival), and starting gear.
- Engage in turn-based combat in one of three fight types:
- Duel: A balanced one-on-one fight.
- Skirmish: A brutal battle with multiple opponents.
- Champion Challenge: Face off against a powerful enemy.
- Manage your health, stamina, and action points wisely to survive.
- AP (Action Points) are required to perform actions and renew at the start of each turn.
- Some actions also consume stamina, which can be recovered using a Strong Brew or by clicking Recover.
- Repositioning before attacking grants a hit bonus.
- To attack with melee or unarmed weapons, you must be close to your opponent. You start at a distance and can move closer or retreat by clicking Move.
- Click Next Turn to end your turn.
- Equipment wears down and can break over time.
- Winning battles lets you level up and upgrade your character. Each motivation grants different bonuses for upgrades.
2. Pit Masters – Pit Management
Become the mastermind behind a fighting pit!
- Create a Pit Master and recruit fighters from the first game. Each fighter has a gold cost based on their level.
- Fighters are disposable: many will die quickly if you don’t manage them wisely.
- Every turn, a random enemy is chosen. Select a fighter to face them. If your fighter dies, they are permanently removed from your roster.
- Choose fighters strategically. Gladiator beats Brawler, Brawler beats Noble, Noble beats Mercenary, and Mercenary beats Gladiator.
- The event type determines the amount of gold and reputation you can earn.
- Victory comes when you reach 10 reputation points and establish yourself as the dominant pit master.
3. Pit Rats – Underground Rebellion
Explore the dark underbelly of the fighting pits.
- Select a Pit Master created in the previous game who has fighters, then choose one fighter to navigate the tunnels.
- Encounter traps, ambushes, and potential allies along the way.
- Your reputation affects the likelihood of other fighters helping you.
- If your chosen fighter dies, you can play again with another one, until you defeat the Pit Master.
Combat System
Fighting in Medieval Pits relies on a tactical turn-based system:
- You and your opponent take turns attacking, defending, or using special actions.
- Stamina is spent on attacking, dodging and blocking.
- Action Points (AP) determines how many actions you can take per turn.
- You can combine attack modifiers: strong attack, aimed, knock and disarm in 12 different types of attacks.
- To dodge or block, end the turn with at least 1 AP and 1 Stamina remaining. The attempt is automatic. Armor can increase the cost of dodging. If there is no shield, the character can try to block with a weapon.
- Defeat an enemy by reducing their health to zero.
- When you die, your character information is stored in the cemetery.
Leveling Up
Winning fights earns reputation, which allows you to upgrade your character:
- Gain new skills in melee, unarmed, archery, or versatile combat.
- Improve your health, stamina, or AP.
- Acquire better gear, including weapons and armor.
[[Back|Intro]]<<set $num to 0>>\
<center><h2>Achievements</h2></center>
<<if $achievement[0]>>\
''Arena Champion'' – Reach level 10 as a fighter.
You have survived the brutal pits and honed your skills to perfection. The crowd chants your name!
<<set $num += 1>>
<</if>>\
<<if $achievement[1]>>\
''Living Legend'' – Reach 10 reputation as a fighter.
Your name echoes through the pits, and fighters dream of challenging you. You are more than a warrior: you are a legend!
<<set $num += 1>>
<</if>>\
<<if $achievement[2]>>\
''Blood and Gold'' – Reach 10 reputation as a pit master.
Your fights are the highlight of the city, and your name is spoken in hushed tones. You rule the pits with an iron fist.
<<set $num += 1>>
<</if>>\
<<if $achievement[3]>>\
''Wealth of the Arena'' – Amass 1,000 gold as a pit master.
Gold flows into your coffers like the blood spilled in your arena. You have mastered the art of profit and power.
<<set $num += 1>>
<</if>>\
<<if $achievement[4]>>\
''The New Tyrant'' – Complete the betrayal ending in Pit Rats.
You gained their trust, only to seize power for yourself. The Pit Master is dead, but the pits remain—now under your rule.
<<set $num += 1>>
<</if>>\
<<if $achievement[5]>>\
''Freedom Fighter'' – Complete the liberation ending in Pit Rats.
With steel and defiance, you have slain the Pit Master and freed the enslaved fighters. The pits will no longer claim lives in chains.
<<set $num += 1>>
<</if>>\
Unlocked achievements: $num of 6
<<link "Reset">>\
<<dialog "Confirm Reset">>\
Are you sure you want to delete all achievements? This action cannot be undone.
<<link "Reset">>\
<<set $achievement to []>>
<<run forget('achievement')>>
<<goto "Achievements">>
<<run UI.alert("Achievements deleted.");>>
<</link>> \
<<link "Cancel">><<dialogclose>><</link>>\
<</dialog>>\
<</link>>
[[Back|Intro]][[Main Menu|Intro]]<center><h2>Updates</h2></center>
''0.1.4'' - 01 - mar - 2025
- Mercenaries can now start with a level 2 skill.
- Optimized the skill selection code.
- Count how many of the total achievements have been unlocked and display it in the achievements panel.
- Knock attack now reduces AP to 0 for 1 turn.
- Added new victory text for pit fighters that changes depending on the fighter's background and motivation, and also reveals when they have had enough of the pit master.
- Fixed bugs:
-- Death date not displayed on tomb details.
-- Undefined variable on character death in Pit Fighters.
-- Undefined final enemy action points were causing them to stop attacking.
''0.1.3'' - 28 - feb - 2025
- Included version control.
[[Back|Intro]]